@sprucelabs/spruce-test-fixtures 59.0.18 → 59.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/__tests__/behavioral/views/ViewFixture.test.d.ts +4 -0
- package/build/__tests__/behavioral/views/ViewFixture.test.js +30 -8
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +34 -8
- package/build/esm/tests/fixtures/ViewFixture.d.ts +3 -1
- package/build/esm/tests/fixtures/ViewFixture.js +17 -11
- package/build/tests/fixtures/ViewFixture.d.ts +3 -1
- package/build/tests/fixtures/ViewFixture.js +17 -11
- package/package.json +5 -5
|
@@ -4,6 +4,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
4
4
|
private static fixture;
|
|
5
5
|
private static fixtureNoOptions;
|
|
6
6
|
private static eventFaker;
|
|
7
|
+
private static lastDevice?;
|
|
7
8
|
protected static beforeEach(): Promise<void>;
|
|
8
9
|
protected static canLogin(): Promise<void>;
|
|
9
10
|
protected static loginFallsBackToDemoNumber(): Promise<void>;
|
|
@@ -48,6 +49,9 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
48
49
|
protected static sameFakeThemeEachTime(): Promise<void>;
|
|
49
50
|
protected static sameThemesOnFixture(): Promise<void>;
|
|
50
51
|
protected static canSetController(): Promise<void>;
|
|
52
|
+
protected static deviceIsSetOnFixtureAndFactory(): Promise<void>;
|
|
53
|
+
protected static newDeviceBeforeEach(): Promise<void>;
|
|
54
|
+
private static ViewFixture;
|
|
51
55
|
private static buildLoadOptions;
|
|
52
56
|
private static ScopedByOrgVc;
|
|
53
57
|
private static ScopedByLocationVc;
|
|
@@ -27,14 +27,7 @@ const DEMO_NUMBER_FORMATTED = (0, schema_1.formatPhoneNumber)(constants_1.DEMO_N
|
|
|
27
27
|
let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.default {
|
|
28
28
|
static async beforeEach() {
|
|
29
29
|
await super.beforeEach();
|
|
30
|
-
this.fixture = this.
|
|
31
|
-
controllerMap: {
|
|
32
|
-
scope: ScopeSvc,
|
|
33
|
-
client: ClientSvc,
|
|
34
|
-
scopedByOrg: ScopedByOrgSvc,
|
|
35
|
-
scopedByLocation: ScopedByLocationSvc,
|
|
36
|
-
},
|
|
37
|
-
});
|
|
30
|
+
this.fixture = this.ViewFixture();
|
|
38
31
|
this.fixtureNoOptions = this.Fixture('view');
|
|
39
32
|
this.eventFaker = new EventFaker_1.default();
|
|
40
33
|
await this.eventFaker.fakeRegisterSkill();
|
|
@@ -423,6 +416,29 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.
|
|
|
423
416
|
test_utils_1.assert.isEqual(passedName, name);
|
|
424
417
|
test_utils_1.assert.isEqual(passedVc, Vc);
|
|
425
418
|
}
|
|
419
|
+
static async deviceIsSetOnFixtureAndFactory() {
|
|
420
|
+
const factory = this.fixture.getFactory();
|
|
421
|
+
const device = this.fixture.getDevice();
|
|
422
|
+
//@ts-ignore
|
|
423
|
+
test_utils_1.assert.isEqual(factory.device, device);
|
|
424
|
+
const factory2 = this.ViewFixture();
|
|
425
|
+
test_utils_1.assert.isEqual(factory2.getDevice(), device);
|
|
426
|
+
this.lastDevice = device;
|
|
427
|
+
}
|
|
428
|
+
static async newDeviceBeforeEach() {
|
|
429
|
+
const device = this.fixture.getDevice();
|
|
430
|
+
test_utils_1.assert.isNotEqual(device, this.lastDevice);
|
|
431
|
+
}
|
|
432
|
+
static ViewFixture() {
|
|
433
|
+
return this.Fixture('view', {
|
|
434
|
+
controllerMap: {
|
|
435
|
+
scope: ScopeSvc,
|
|
436
|
+
client: ClientSvc,
|
|
437
|
+
scopedByOrg: ScopedByOrgSvc,
|
|
438
|
+
scopedByLocation: ScopedByLocationSvc,
|
|
439
|
+
},
|
|
440
|
+
});
|
|
441
|
+
}
|
|
426
442
|
static buildLoadOptions() {
|
|
427
443
|
return this.router.buildLoadOptions();
|
|
428
444
|
}
|
|
@@ -599,6 +615,12 @@ __decorate([
|
|
|
599
615
|
__decorate([
|
|
600
616
|
(0, test_utils_1.test)()
|
|
601
617
|
], ViewFixtureTest, "canSetController", null);
|
|
618
|
+
__decorate([
|
|
619
|
+
(0, test_utils_1.test)()
|
|
620
|
+
], ViewFixtureTest, "deviceIsSetOnFixtureAndFactory", null);
|
|
621
|
+
__decorate([
|
|
622
|
+
(0, test_utils_1.test)()
|
|
623
|
+
], ViewFixtureTest, "newDeviceBeforeEach", null);
|
|
602
624
|
ViewFixtureTest = __decorate([
|
|
603
625
|
fake_1.default.login(DEMO_NUMBER_FORMATTED)
|
|
604
626
|
], ViewFixtureTest);
|
|
@@ -4,6 +4,7 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
4
4
|
private static fixture;
|
|
5
5
|
private static fixtureNoOptions;
|
|
6
6
|
private static eventFaker;
|
|
7
|
+
private static lastDevice?;
|
|
7
8
|
protected static beforeEach(): Promise<void>;
|
|
8
9
|
protected static canLogin(): Promise<void>;
|
|
9
10
|
protected static loginFallsBackToDemoNumber(): Promise<void>;
|
|
@@ -48,6 +49,9 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
48
49
|
protected static sameFakeThemeEachTime(): Promise<void>;
|
|
49
50
|
protected static sameThemesOnFixture(): Promise<void>;
|
|
50
51
|
protected static canSetController(): Promise<void>;
|
|
52
|
+
protected static deviceIsSetOnFixtureAndFactory(): Promise<void>;
|
|
53
|
+
protected static newDeviceBeforeEach(): Promise<void>;
|
|
54
|
+
private static ViewFixture;
|
|
51
55
|
private static buildLoadOptions;
|
|
52
56
|
private static ScopedByOrgVc;
|
|
53
57
|
private static ScopedByLocationVc;
|
|
@@ -35,14 +35,7 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
35
35
|
});
|
|
36
36
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
37
|
yield _super.beforeEach.call(this);
|
|
38
|
-
this.fixture = this.
|
|
39
|
-
controllerMap: {
|
|
40
|
-
scope: ScopeSvc,
|
|
41
|
-
client: ClientSvc,
|
|
42
|
-
scopedByOrg: ScopedByOrgSvc,
|
|
43
|
-
scopedByLocation: ScopedByLocationSvc,
|
|
44
|
-
},
|
|
45
|
-
});
|
|
38
|
+
this.fixture = this.ViewFixture();
|
|
46
39
|
this.fixtureNoOptions = this.Fixture('view');
|
|
47
40
|
this.eventFaker = new EventFaker();
|
|
48
41
|
yield this.eventFaker.fakeRegisterSkill();
|
|
@@ -496,6 +489,33 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
|
496
489
|
assert.isEqual(passedVc, Vc);
|
|
497
490
|
});
|
|
498
491
|
}
|
|
492
|
+
static deviceIsSetOnFixtureAndFactory() {
|
|
493
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
494
|
+
const factory = this.fixture.getFactory();
|
|
495
|
+
const device = this.fixture.getDevice();
|
|
496
|
+
//@ts-ignore
|
|
497
|
+
assert.isEqual(factory.device, device);
|
|
498
|
+
const factory2 = this.ViewFixture();
|
|
499
|
+
assert.isEqual(factory2.getDevice(), device);
|
|
500
|
+
this.lastDevice = device;
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
static newDeviceBeforeEach() {
|
|
504
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
505
|
+
const device = this.fixture.getDevice();
|
|
506
|
+
assert.isNotEqual(device, this.lastDevice);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
static ViewFixture() {
|
|
510
|
+
return this.Fixture('view', {
|
|
511
|
+
controllerMap: {
|
|
512
|
+
scope: ScopeSvc,
|
|
513
|
+
client: ClientSvc,
|
|
514
|
+
scopedByOrg: ScopedByOrgSvc,
|
|
515
|
+
scopedByLocation: ScopedByLocationSvc,
|
|
516
|
+
},
|
|
517
|
+
});
|
|
518
|
+
}
|
|
499
519
|
static buildLoadOptions() {
|
|
500
520
|
return this.router.buildLoadOptions();
|
|
501
521
|
}
|
|
@@ -676,6 +696,12 @@ __decorate([
|
|
|
676
696
|
__decorate([
|
|
677
697
|
test()
|
|
678
698
|
], ViewFixtureTest, "canSetController", null);
|
|
699
|
+
__decorate([
|
|
700
|
+
test()
|
|
701
|
+
], ViewFixtureTest, "deviceIsSetOnFixtureAndFactory", null);
|
|
702
|
+
__decorate([
|
|
703
|
+
test()
|
|
704
|
+
], ViewFixtureTest, "newDeviceBeforeEach", null);
|
|
679
705
|
ViewFixtureTest = __decorate([
|
|
680
706
|
fake.login(DEMO_NUMBER_FORMATTED)
|
|
681
707
|
], ViewFixtureTest);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Locale } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { ControllerOptions, Scope, SkillViewController, ViewControllerFactory, ViewControllerId, ViewController, ViewControllerConstructor } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { ControllerOptions, Scope, SkillViewController, SpyDevice, ViewControllerFactory, ViewControllerId, ViewController, ViewControllerConstructor } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
4
4
|
import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
|
|
5
5
|
import { ClientProxyDecorator } from '../..';
|
|
@@ -30,6 +30,7 @@ export default class ViewFixture {
|
|
|
30
30
|
private proxyDecorator;
|
|
31
31
|
private locale;
|
|
32
32
|
private permissions;
|
|
33
|
+
private static device?;
|
|
33
34
|
static lockProxyCacheForPerson(id: any): void;
|
|
34
35
|
static setShouldAutomaticallyResetAuth(shouldReset: false): void;
|
|
35
36
|
constructor(options: {
|
|
@@ -47,6 +48,7 @@ export default class ViewFixture {
|
|
|
47
48
|
getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
|
|
48
49
|
render<VC extends ViewController<any>>(vc: VC): ReturnType<VC['render']>;
|
|
49
50
|
private static getSharedFactory;
|
|
51
|
+
getDevice(): SpyDevice;
|
|
50
52
|
Controller<N extends ViewControllerId>(name: N, options: ControllerOptions<N>): import("@sprucelabs/heartwood-view-controllers").ViewControllerMap[N];
|
|
51
53
|
setController<Vc extends ViewController<any>>(name: ViewControllerId, Class: ViewControllerConstructor<Vc>): void;
|
|
52
54
|
setClient(client: MercuryClient): void;
|
|
@@ -26,20 +26,22 @@ class ViewFixture {
|
|
|
26
26
|
this.shouldAutomaticallyResetAuthenticator = shouldReset;
|
|
27
27
|
}
|
|
28
28
|
constructor(options) {
|
|
29
|
-
|
|
30
|
-
this.connectToApi =
|
|
31
|
-
this.people =
|
|
32
|
-
this.vcDir =
|
|
33
|
-
(_a = options === null || options === void 0 ? void 0 : options.vcDir) !== null && _a !== void 0 ? _a : diskUtil.resolvePath((_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd(), 'build');
|
|
29
|
+
const { connectToApi, people, fixtureFactory, vcDir, cwd, namespace, proxyDecorator, permissions, } = options;
|
|
30
|
+
this.connectToApi = connectToApi;
|
|
31
|
+
this.people = people;
|
|
32
|
+
this.vcDir = vcDir !== null && vcDir !== void 0 ? vcDir : diskUtil.resolvePath(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), 'build');
|
|
34
33
|
this.controllerMap = options === null || options === void 0 ? void 0 : options.controllerMap;
|
|
35
|
-
this.namespace =
|
|
36
|
-
this.proxyDecorator =
|
|
37
|
-
this.orgs =
|
|
34
|
+
this.namespace = namespace;
|
|
35
|
+
this.proxyDecorator = proxyDecorator;
|
|
36
|
+
this.orgs = fixtureFactory.Fixture('organization', {
|
|
38
37
|
people: this.people,
|
|
39
38
|
});
|
|
40
|
-
this.permissions =
|
|
39
|
+
this.permissions = permissions;
|
|
40
|
+
if (!ViewFixture.device) {
|
|
41
|
+
ViewFixture.device = new SpyDevice();
|
|
42
|
+
}
|
|
41
43
|
this.locale = new LocaleImpl();
|
|
42
|
-
this.locations =
|
|
44
|
+
this.locations = fixtureFactory.Fixture('location', {
|
|
43
45
|
people: this.people,
|
|
44
46
|
organizations: this.orgs,
|
|
45
47
|
});
|
|
@@ -89,7 +91,7 @@ class ViewFixture {
|
|
|
89
91
|
}
|
|
90
92
|
this.vcFactory = ViewControllerFactory.Factory({
|
|
91
93
|
controllerMap,
|
|
92
|
-
device:
|
|
94
|
+
device: this.device,
|
|
93
95
|
connectToApi: (options) => __awaiter(this, void 0, void 0, function* () {
|
|
94
96
|
var _a;
|
|
95
97
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
|
@@ -111,6 +113,9 @@ class ViewFixture {
|
|
|
111
113
|
};
|
|
112
114
|
return this.vcFactory;
|
|
113
115
|
}
|
|
116
|
+
getDevice() {
|
|
117
|
+
return ViewFixture.device;
|
|
118
|
+
}
|
|
114
119
|
Controller(name, options) {
|
|
115
120
|
var _a;
|
|
116
121
|
try {
|
|
@@ -145,6 +150,7 @@ class ViewFixture {
|
|
|
145
150
|
this.resetAuth();
|
|
146
151
|
}
|
|
147
152
|
this.viewClient = undefined;
|
|
153
|
+
this.device = undefined;
|
|
148
154
|
const lockedToken = this.dontResetProxyTokenForPersonId &&
|
|
149
155
|
ViewFixture.loggedInPersonProxyTokens[this.dontResetProxyTokenForPersonId];
|
|
150
156
|
ViewFixture.loggedInPersonProxyTokens = {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Locale } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { ControllerOptions, Scope, SkillViewController, ViewControllerFactory, ViewControllerId, ViewController, ViewControllerConstructor } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { ControllerOptions, Scope, SkillViewController, SpyDevice, ViewControllerFactory, ViewControllerId, ViewController, ViewControllerConstructor } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import { MercuryClient } from '@sprucelabs/mercury-client';
|
|
4
4
|
import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
|
|
5
5
|
import { ClientProxyDecorator } from '../..';
|
|
@@ -30,6 +30,7 @@ export default class ViewFixture {
|
|
|
30
30
|
private proxyDecorator;
|
|
31
31
|
private locale;
|
|
32
32
|
private permissions;
|
|
33
|
+
private static device?;
|
|
33
34
|
static lockProxyCacheForPerson(id: any): void;
|
|
34
35
|
static setShouldAutomaticallyResetAuth(shouldReset: false): void;
|
|
35
36
|
constructor(options: {
|
|
@@ -47,6 +48,7 @@ export default class ViewFixture {
|
|
|
47
48
|
getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
|
|
48
49
|
render<VC extends ViewController<any>>(vc: VC): ReturnType<VC['render']>;
|
|
49
50
|
private static getSharedFactory;
|
|
51
|
+
getDevice(): SpyDevice;
|
|
50
52
|
Controller<N extends ViewControllerId>(name: N, options: ControllerOptions<N>): import("@sprucelabs/heartwood-view-controllers").ViewControllerMap[N];
|
|
51
53
|
setController<Vc extends ViewController<any>>(name: ViewControllerId, Class: ViewControllerConstructor<Vc>): void;
|
|
52
54
|
setClient(client: MercuryClient): void;
|
|
@@ -22,20 +22,22 @@ class ViewFixture {
|
|
|
22
22
|
this.shouldAutomaticallyResetAuthenticator = shouldReset;
|
|
23
23
|
}
|
|
24
24
|
constructor(options) {
|
|
25
|
-
|
|
26
|
-
this.connectToApi =
|
|
27
|
-
this.people =
|
|
28
|
-
this.vcDir =
|
|
29
|
-
(_a = options === null || options === void 0 ? void 0 : options.vcDir) !== null && _a !== void 0 ? _a : spruce_skill_utils_1.diskUtil.resolvePath((_b = options.cwd) !== null && _b !== void 0 ? _b : process.cwd(), 'build');
|
|
25
|
+
const { connectToApi, people, fixtureFactory, vcDir, cwd, namespace, proxyDecorator, permissions, } = options;
|
|
26
|
+
this.connectToApi = connectToApi;
|
|
27
|
+
this.people = people;
|
|
28
|
+
this.vcDir = vcDir !== null && vcDir !== void 0 ? vcDir : spruce_skill_utils_1.diskUtil.resolvePath(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), 'build');
|
|
30
29
|
this.controllerMap = options === null || options === void 0 ? void 0 : options.controllerMap;
|
|
31
|
-
this.namespace =
|
|
32
|
-
this.proxyDecorator =
|
|
33
|
-
this.orgs =
|
|
30
|
+
this.namespace = namespace;
|
|
31
|
+
this.proxyDecorator = proxyDecorator;
|
|
32
|
+
this.orgs = fixtureFactory.Fixture('organization', {
|
|
34
33
|
people: this.people,
|
|
35
34
|
});
|
|
36
|
-
this.permissions =
|
|
35
|
+
this.permissions = permissions;
|
|
36
|
+
if (!ViewFixture.device) {
|
|
37
|
+
ViewFixture.device = new heartwood_view_controllers_1.SpyDevice();
|
|
38
|
+
}
|
|
37
39
|
this.locale = new calendar_utils_1.LocaleImpl();
|
|
38
|
-
this.locations =
|
|
40
|
+
this.locations = fixtureFactory.Fixture('location', {
|
|
39
41
|
people: this.people,
|
|
40
42
|
organizations: this.orgs,
|
|
41
43
|
});
|
|
@@ -85,7 +87,7 @@ class ViewFixture {
|
|
|
85
87
|
}
|
|
86
88
|
this.vcFactory = heartwood_view_controllers_1.ViewControllerFactory.Factory({
|
|
87
89
|
controllerMap,
|
|
88
|
-
device:
|
|
90
|
+
device: this.device,
|
|
89
91
|
connectToApi: async (options) => {
|
|
90
92
|
var _a;
|
|
91
93
|
return (_a = this.viewClient) !== null && _a !== void 0 ? _a : connectToApi(options);
|
|
@@ -107,6 +109,9 @@ class ViewFixture {
|
|
|
107
109
|
};
|
|
108
110
|
return this.vcFactory;
|
|
109
111
|
}
|
|
112
|
+
getDevice() {
|
|
113
|
+
return ViewFixture.device;
|
|
114
|
+
}
|
|
110
115
|
Controller(name, options) {
|
|
111
116
|
var _a;
|
|
112
117
|
try {
|
|
@@ -138,6 +143,7 @@ class ViewFixture {
|
|
|
138
143
|
this.resetAuth();
|
|
139
144
|
}
|
|
140
145
|
this.viewClient = undefined;
|
|
146
|
+
this.device = undefined;
|
|
141
147
|
const lockedToken = this.dontResetProxyTokenForPersonId &&
|
|
142
148
|
ViewFixture.loggedInPersonProxyTokens[this.dontResetProxyTokenForPersonId];
|
|
143
149
|
ViewFixture.loggedInPersonProxyTokens = {};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "59.0.
|
|
16
|
+
"version": "59.0.20",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@sprucelabs/data-stores": "^24.0.14",
|
|
66
66
|
"@sprucelabs/error": "^5.1.4",
|
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^104.5.
|
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^104.5.3",
|
|
68
68
|
"@sprucelabs/mercury-client": "^40.1.35",
|
|
69
69
|
"@sprucelabs/mercury-core-events": "^21.1.25",
|
|
70
70
|
"@sprucelabs/mercury-event-emitter": "^40.1.35",
|
|
71
71
|
"@sprucelabs/schema": "^28.6.33",
|
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^38.1.26",
|
|
73
73
|
"@sprucelabs/spruce-event-utils": "^37.0.29",
|
|
74
|
-
"@sprucelabs/spruce-permission-utils": "^5.0.
|
|
75
|
-
"@sprucelabs/spruce-skill-booter": "^59.0.
|
|
74
|
+
"@sprucelabs/spruce-permission-utils": "^5.0.49",
|
|
75
|
+
"@sprucelabs/spruce-skill-booter": "^59.0.20",
|
|
76
76
|
"@sprucelabs/spruce-skill-utils": "^29.0.16",
|
|
77
77
|
"@sprucelabs/test-utils": "^3.4.62",
|
|
78
78
|
"dotenv": "^16.0.3",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
]
|
|
133
133
|
]
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "415338cf52673b614c5466be710a5bdef4f41838"
|
|
136
136
|
}
|