@sprucelabs/spruce-test-fixtures 44.1.39 → 44.2.1
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/esm/tests/decorators/fake.js +7 -2
- package/build/esm/tests/fixtures/ViewFixture.d.ts +1 -0
- package/build/esm/tests/fixtures/ViewFixture.js +3 -0
- package/build/tests/decorators/fake.js +7 -2
- package/build/tests/fixtures/ViewFixture.d.ts +1 -0
- package/build/tests/fixtures/ViewFixture.js +3 -0
- package/package.json +4 -4
|
@@ -81,13 +81,15 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
81
81
|
MercuryClientFactory.setIsTestMode(true);
|
|
82
82
|
seed.disableResettingTestClient();
|
|
83
83
|
return function (TestClass, shouldPassHookCalls = true) {
|
|
84
|
-
var _a, _b;
|
|
84
|
+
var _a, _b, _c;
|
|
85
85
|
if (!(TestClass.prototype instanceof AbstractSpruceFixtureTest)) {
|
|
86
86
|
testLog.warn(`@fake.login() is attached to an incompatible test class (${TestClass.name}). You can safely remove it or have your test class extend AbstractSpruceFixtureTest.`);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
const Class = TestClass;
|
|
90
90
|
const beforeEach = (_a = Class.beforeEach) === null || _a === void 0 ? void 0 : _a.bind(Class);
|
|
91
|
+
const beforeAll = (_b = Class.beforeAll) === null || _b === void 0 ? void 0 : _b.bind(Class);
|
|
92
|
+
const afterEach = (_c = Class.afterEach) === null || _c === void 0 ? void 0 : _c.bind(Class);
|
|
91
93
|
if (shouldPassHookCalls) {
|
|
92
94
|
const old = MercuryFixture.beforeEach.bind(MercuryFixture);
|
|
93
95
|
MercuryFixture.beforeEach = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -97,7 +99,6 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
97
99
|
MercuryFixture.setDefaultClient(Class.fakedOwnerClient);
|
|
98
100
|
});
|
|
99
101
|
}
|
|
100
|
-
const beforeAll = (_b = Class.beforeAll) === null || _b === void 0 ? void 0 : _b.bind(Class);
|
|
101
102
|
Class.beforeAll = () => __awaiter(this, void 0, void 0, function* () {
|
|
102
103
|
yield (beforeAll === null || beforeAll === void 0 ? void 0 : beforeAll());
|
|
103
104
|
resetFakes(Class);
|
|
@@ -105,6 +106,10 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
105
106
|
yield login(Class, phone);
|
|
106
107
|
MercuryFixture.setDefaultClient(Class.fakedOwnerClient);
|
|
107
108
|
});
|
|
109
|
+
Class.afterEach = () => __awaiter(this, void 0, void 0, function* () {
|
|
110
|
+
yield setupFakes(Class);
|
|
111
|
+
yield (afterEach === null || afterEach === void 0 ? void 0 : afterEach());
|
|
112
|
+
});
|
|
108
113
|
Class.beforeEach = () => __awaiter(this, void 0, void 0, function* () {
|
|
109
114
|
yield fakeAuthenticationEvents(Class);
|
|
110
115
|
resetFakes(Class);
|
|
@@ -45,6 +45,7 @@ export default class ViewFixture {
|
|
|
45
45
|
render<VC extends ViewController<any>>(vc: VC): ReturnType<VC['render']>;
|
|
46
46
|
private static getSharedFactory;
|
|
47
47
|
Controller<N extends ViewControllerId>(name: N, options: ControllerOptions<N>): import("@sprucelabs/heartwood-view-controllers").ViewControllerMap[N];
|
|
48
|
+
setClient(client: MercuryClient): void;
|
|
48
49
|
static beforeAll(): Promise<void>;
|
|
49
50
|
static beforeEach(): Promise<void>;
|
|
50
51
|
private static resetMaps;
|
|
@@ -79,13 +79,15 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
79
79
|
mercury_client_1.MercuryClientFactory.setIsTestMode(true);
|
|
80
80
|
seed_1.default.disableResettingTestClient();
|
|
81
81
|
return function (TestClass, shouldPassHookCalls = true) {
|
|
82
|
-
var _a, _b;
|
|
82
|
+
var _a, _b, _c;
|
|
83
83
|
if (!(TestClass.prototype instanceof AbstractSpruceFixtureTest_1.default)) {
|
|
84
84
|
spruce_skill_utils_1.testLog.warn(`@fake.login() is attached to an incompatible test class (${TestClass.name}). You can safely remove it or have your test class extend AbstractSpruceFixtureTest.`);
|
|
85
85
|
return;
|
|
86
86
|
}
|
|
87
87
|
const Class = TestClass;
|
|
88
88
|
const beforeEach = (_a = Class.beforeEach) === null || _a === void 0 ? void 0 : _a.bind(Class);
|
|
89
|
+
const beforeAll = (_b = Class.beforeAll) === null || _b === void 0 ? void 0 : _b.bind(Class);
|
|
90
|
+
const afterEach = (_c = Class.afterEach) === null || _c === void 0 ? void 0 : _c.bind(Class);
|
|
89
91
|
if (shouldPassHookCalls) {
|
|
90
92
|
const old = MercuryFixture_1.default.beforeEach.bind(MercuryFixture_1.default);
|
|
91
93
|
MercuryFixture_1.default.beforeEach = async (...args) => {
|
|
@@ -95,7 +97,6 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
95
97
|
MercuryFixture_1.default.setDefaultClient(Class.fakedOwnerClient);
|
|
96
98
|
};
|
|
97
99
|
}
|
|
98
|
-
const beforeAll = (_b = Class.beforeAll) === null || _b === void 0 ? void 0 : _b.bind(Class);
|
|
99
100
|
Class.beforeAll = async () => {
|
|
100
101
|
await (beforeAll === null || beforeAll === void 0 ? void 0 : beforeAll());
|
|
101
102
|
resetFakes(Class);
|
|
@@ -103,6 +104,10 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
103
104
|
await login(Class, phone);
|
|
104
105
|
MercuryFixture_1.default.setDefaultClient(Class.fakedOwnerClient);
|
|
105
106
|
};
|
|
107
|
+
Class.afterEach = async () => {
|
|
108
|
+
await setupFakes(Class);
|
|
109
|
+
await (afterEach === null || afterEach === void 0 ? void 0 : afterEach());
|
|
110
|
+
};
|
|
106
111
|
Class.beforeEach = async () => {
|
|
107
112
|
await fakeAuthenticationEvents(Class);
|
|
108
113
|
resetFakes(Class);
|
|
@@ -45,6 +45,7 @@ export default class ViewFixture {
|
|
|
45
45
|
render<VC extends ViewController<any>>(vc: VC): ReturnType<VC['render']>;
|
|
46
46
|
private static getSharedFactory;
|
|
47
47
|
Controller<N extends ViewControllerId>(name: N, options: ControllerOptions<N>): import("@sprucelabs/heartwood-view-controllers").ViewControllerMap[N];
|
|
48
|
+
setClient(client: MercuryClient): void;
|
|
48
49
|
static beforeAll(): Promise<void>;
|
|
49
50
|
static beforeEach(): Promise<void>;
|
|
50
51
|
private static resetMaps;
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "44.1
|
|
16
|
+
"version": "44.2.1",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@sprucelabs/data-stores": "^17.0.51",
|
|
66
66
|
"@sprucelabs/error": "^5.0.487",
|
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^86.12.
|
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^86.12.2",
|
|
68
68
|
"@sprucelabs/mercury-client": "^31.0.82",
|
|
69
69
|
"@sprucelabs/mercury-core-events": "^12.0.83",
|
|
70
70
|
"@sprucelabs/mercury-event-emitter": "^31.0.82",
|
|
71
71
|
"@sprucelabs/schema": "^28.3.13",
|
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^34.2.11",
|
|
73
73
|
"@sprucelabs/spruce-event-utils": "^27.0.62",
|
|
74
|
-
"@sprucelabs/spruce-skill-booter": "^44.1
|
|
74
|
+
"@sprucelabs/spruce-skill-booter": "^44.2.1",
|
|
75
75
|
"@sprucelabs/spruce-skill-utils": "^26.2.9",
|
|
76
76
|
"dotenv": "^16.0.1",
|
|
77
77
|
"unique-names-generator": "^4.7.1"
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
]
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "1c2891ca64be4fc9d176803e08b5c284057f38c4"
|
|
135
135
|
}
|