@sprucelabs/spruce-test-fixtures 61.1.35 → 62.0.1
Sign up to get free protection for your applications and to get access to all the features.
- package/build/.spruce/errors/errors.types.d.ts +30 -27
- package/build/.spruce/errors/errors.types.js +0 -2
- package/build/.spruce/errors/options.types.d.ts +2 -2
- package/build/.spruce/errors/spruceTestFixtures/fakeEventError.schema.js +3 -3
- package/build/.spruce/errors/spruceTestFixtures/invalidFixture.schema.js +5 -5
- package/build/.spruce/errors/spruceTestFixtures/invalidScopeRequest.schema.js +10 -5
- package/build/.spruce/errors/spruceTestFixtures/invalidTarget.schema.js +1 -1
- package/build/.spruce/errors/spruceTestFixtures/invalidViewController.schema.js +5 -5
- package/build/.spruce/errors/spruceTestFixtures/notFound.schema.js +1 -1
- package/build/.spruce/errors/spruceTestFixtures/scopeRequirementsNotMet.schema.js +1 -1
- package/build/.spruce/errors/spruceTestFixtures/skillNotFound.schema.js +3 -3
- package/build/.spruce/errors/spruceTestFixtures/unknownViewControllerError.schema.js +5 -5
- package/build/.spruce/schemas/fields/fields.types.d.ts +1 -1
- package/build/.spruce/schemas/schemas.types.d.ts +7 -7
- package/build/.spruce/schemas/schemas.types.js +0 -2
- package/build/.spruce/schemas/spruceTestFixtures/v2021_07_19/testRouterEmitPayload.schema.js +9 -7
- package/build/ClientProxyDecorator.js +6 -2
- package/build/__tests__/behavioral/OrganizationFixture.test.js +3 -1
- package/build/__tests__/behavioral/PhoneNumberIncrementor.test.js +4 -4
- package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +3 -1
- package/build/__tests__/behavioral/faking/FakeDecorator.test.js +5 -2
- package/build/__tests__/behavioral/faking/WhoAmI.test.js +3 -1
- package/build/__tests__/behavioral/seeding/SeedingData.test.js +3 -3
- package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +3 -1
- package/build/__tests__/behavioral/views/ViewFixture.test.js +3 -1
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/.spruce/stores/stores.js +1 -1
- package/build/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +3 -3
- package/build/__tests__/testDirsAndFiles/plugins1/build/.spruce/views/views.d.ts +1 -1
- package/build/__tests__/testDirsAndFiles/plugins2/build/.spruce/views/views.d.ts +1 -1
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +1 -1
- package/build/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +1 -1
- package/build/__tests__/testDirsAndFiles/skill/src/.spruce/views/views.js +2 -1
- package/build/errors/SpruceError.d.ts +1 -1
- package/build/esm/.spruce/errors/errors.types.d.ts +30 -27
- package/build/esm/.spruce/errors/errors.types.js +0 -2
- package/build/esm/.spruce/errors/options.types.d.ts +2 -2
- package/build/esm/.spruce/schemas/schemas.types.d.ts +7 -7
- package/build/esm/.spruce/schemas/schemas.types.js +0 -2
- package/build/esm/.spruce/schemas/spruceTestFixtures/v2021_07_19/testRouterEmitPayload.schema.js +9 -7
- package/build/esm/ClientProxyDecorator.js +6 -2
- package/build/esm/__tests__/behavioral/OrganizationFixture.test.js +3 -1
- package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.js +4 -4
- package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +3 -1
- package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.js +5 -2
- package/build/esm/__tests__/behavioral/faking/WhoAmI.test.js +3 -1
- package/build/esm/__tests__/behavioral/seeding/SeedingData.test.js +3 -3
- package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +3 -1
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +3 -1
- package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js +3 -3
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Book.svc.d.ts +1 -1
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.d.ts +1 -1
- package/build/esm/__tests__/testDirsAndFiles/skill/build/skillViewControllers/Spy.svc.js +1 -1
- package/build/esm/errors/SpruceError.d.ts +1 -1
- package/build/esm/index.d.ts +1 -1
- package/build/esm/tests/decorators/fake.js +16 -6
- package/build/esm/tests/fixtures/FixtureFactory.js +4 -2
- package/build/esm/tests/fixtures/MercuryFixture.js +5 -3
- package/build/esm/tests/fixtures/PersonFixture.js +2 -1
- package/build/esm/tests/fixtures/ViewFixture.js +2 -1
- package/build/index.d.ts +1 -1
- package/build/tests/decorators/fake.js +16 -6
- package/build/tests/fixtures/FixtureFactory.js +4 -2
- package/build/tests/fixtures/MercuryFixture.js +5 -3
- package/build/tests/fixtures/PersonFixture.js +2 -1
- package/build/tests/fixtures/ViewFixture.js +2 -1
- package/package.json +32 -32
@@ -1,5 +1,5 @@
|
|
1
1
|
import BaseSpruceError from '@sprucelabs/error';
|
2
|
-
import ErrorOptions from
|
2
|
+
import ErrorOptions from './../.spruce/errors/options.types';
|
3
3
|
export default class SpruceError extends BaseSpruceError<ErrorOptions> {
|
4
4
|
friendlyMessage(): string;
|
5
5
|
}
|
@@ -2,8 +2,8 @@ import { default as SchemaEntity } from '@sprucelabs/schema';
|
|
2
2
|
import * as SpruceSchema from '@sprucelabs/schema';
|
3
3
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
4
4
|
interface UnknownViewControllerError {
|
5
|
-
|
6
|
-
|
5
|
+
id?: string | undefined | null;
|
6
|
+
name?: string | undefined | null;
|
7
7
|
}
|
8
8
|
interface UnknownViewControllerErrorSchema extends SpruceSchema.Schema {
|
9
9
|
id: 'unknownViewControllerError';
|
@@ -11,12 +11,12 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
11
11
|
name: 'Unkown view controller error';
|
12
12
|
fields: {
|
13
13
|
/** . */
|
14
|
-
|
14
|
+
id: {
|
15
15
|
type: 'text';
|
16
16
|
options: undefined;
|
17
17
|
};
|
18
18
|
/** . */
|
19
|
-
|
19
|
+
name: {
|
20
20
|
type: 'text';
|
21
21
|
options: undefined;
|
22
22
|
};
|
@@ -26,7 +26,7 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
26
26
|
}
|
27
27
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
28
28
|
interface SkillNotFound {
|
29
|
-
|
29
|
+
slug: string;
|
30
30
|
}
|
31
31
|
interface SkillNotFoundSchema extends SpruceSchema.Schema {
|
32
32
|
id: 'skillNotFound';
|
@@ -34,7 +34,7 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
34
34
|
name: 'Skill not found';
|
35
35
|
fields: {
|
36
36
|
/** . */
|
37
|
-
|
37
|
+
slug: {
|
38
38
|
type: 'text';
|
39
39
|
isRequired: true;
|
40
40
|
options: undefined;
|
@@ -67,8 +67,8 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
67
67
|
}
|
68
68
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
69
69
|
interface InvalidViewController {
|
70
|
-
|
71
|
-
|
70
|
+
name?: string | undefined | null;
|
71
|
+
id?: string | undefined | null;
|
72
72
|
}
|
73
73
|
interface InvalidViewControllerSchema extends SpruceSchema.Schema {
|
74
74
|
id: 'invalidViewController';
|
@@ -76,12 +76,12 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
76
76
|
name: 'Invalid view controller';
|
77
77
|
fields: {
|
78
78
|
/** . */
|
79
|
-
|
79
|
+
name: {
|
80
80
|
type: 'text';
|
81
81
|
options: undefined;
|
82
82
|
};
|
83
83
|
/** . */
|
84
|
-
|
84
|
+
id: {
|
85
85
|
type: 'text';
|
86
86
|
options: undefined;
|
87
87
|
};
|
@@ -102,8 +102,8 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
102
102
|
}
|
103
103
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
104
104
|
interface InvalidScopeRequest {
|
105
|
-
|
106
|
-
|
105
|
+
flags: string[];
|
106
|
+
attemptedToGet: 'location' | 'organization';
|
107
107
|
}
|
108
108
|
interface InvalidScopeRequestSchema extends SpruceSchema.Schema {
|
109
109
|
id: 'invalidScopeRequest';
|
@@ -111,24 +111,27 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
111
111
|
name: '';
|
112
112
|
fields: {
|
113
113
|
/** . */
|
114
|
-
|
114
|
+
flags: {
|
115
115
|
type: 'text';
|
116
116
|
isRequired: true;
|
117
117
|
isArray: true;
|
118
118
|
options: undefined;
|
119
119
|
};
|
120
120
|
/** . */
|
121
|
-
|
121
|
+
attemptedToGet: {
|
122
122
|
type: 'select';
|
123
123
|
isRequired: true;
|
124
124
|
options: {
|
125
|
-
choices: [
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
125
|
+
choices: [
|
126
|
+
{
|
127
|
+
value: 'location';
|
128
|
+
label: 'Location';
|
129
|
+
},
|
130
|
+
{
|
131
|
+
value: 'organization';
|
132
|
+
label: 'Organization';
|
133
|
+
}
|
134
|
+
];
|
132
135
|
};
|
133
136
|
};
|
134
137
|
};
|
@@ -137,8 +140,8 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
137
140
|
}
|
138
141
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
139
142
|
interface InvalidFixture {
|
140
|
-
|
141
|
-
|
143
|
+
suppliedName: string;
|
144
|
+
validNames: string[];
|
142
145
|
}
|
143
146
|
interface InvalidFixtureSchema extends SpruceSchema.Schema {
|
144
147
|
id: 'invalidFixture';
|
@@ -146,13 +149,13 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
146
149
|
name: 'Invalid factory';
|
147
150
|
fields: {
|
148
151
|
/** . */
|
149
|
-
|
152
|
+
suppliedName: {
|
150
153
|
type: 'text';
|
151
154
|
isRequired: true;
|
152
155
|
options: undefined;
|
153
156
|
};
|
154
157
|
/** . */
|
155
|
-
|
158
|
+
validNames: {
|
156
159
|
type: 'text';
|
157
160
|
isRequired: true;
|
158
161
|
isArray: true;
|
@@ -164,7 +167,7 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
164
167
|
}
|
165
168
|
export declare namespace SpruceErrors.SpruceTestFixtures {
|
166
169
|
interface FakeEventError {
|
167
|
-
|
170
|
+
fqen: string;
|
168
171
|
}
|
169
172
|
interface FakeEventErrorSchema extends SpruceSchema.Schema {
|
170
173
|
id: 'fakeEventError';
|
@@ -172,7 +175,7 @@ export declare namespace SpruceErrors.SpruceTestFixtures {
|
|
172
175
|
name: 'Fake event error';
|
173
176
|
fields: {
|
174
177
|
/** . */
|
175
|
-
|
178
|
+
fqen: {
|
176
179
|
type: 'text';
|
177
180
|
isRequired: true;
|
178
181
|
options: undefined;
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
1
|
+
import { ErrorOptions as ISpruceErrorOptions } from '@sprucelabs/error';
|
2
|
+
import { SpruceErrors } from './errors.types';
|
3
3
|
export interface UnknownViewControllerErrorErrorOptions extends SpruceErrors.SpruceTestFixtures.UnknownViewControllerError, ISpruceErrorOptions {
|
4
4
|
code: 'UNKNOWN_VIEW_CONTROLLER_ERROR';
|
5
5
|
}
|
@@ -1,13 +1,13 @@
|
|
1
1
|
export { SpruceSchemas } from '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schemas.types';
|
2
|
+
import * as HeartwoodViewController from '@sprucelabs/heartwood-view-controllers';
|
2
3
|
import { default as SchemaEntity } from '@sprucelabs/schema';
|
3
4
|
import * as SpruceSchema from '@sprucelabs/schema';
|
4
|
-
import * as HeartwoodViewController from "@sprucelabs/heartwood-view-controllers";
|
5
5
|
declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schemas.types' {
|
6
6
|
namespace SpruceSchemas.SpruceTestFixtures.v2021_07_19 {
|
7
7
|
interface TestRouterEmitPayload {
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
id: string;
|
9
|
+
vc: HeartwoodViewController.SkillViewController;
|
10
|
+
args?: Record<string, any> | undefined | null;
|
11
11
|
}
|
12
12
|
interface TestRouterEmitPayloadSchema extends SpruceSchema.Schema {
|
13
13
|
id: 'testRouterEmitPayload';
|
@@ -16,13 +16,13 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
16
16
|
name: 'Test Router Emit payload';
|
17
17
|
fields: {
|
18
18
|
/** . */
|
19
|
-
|
19
|
+
id: {
|
20
20
|
type: 'text';
|
21
21
|
isRequired: true;
|
22
22
|
options: undefined;
|
23
23
|
};
|
24
24
|
/** . */
|
25
|
-
|
25
|
+
vc: {
|
26
26
|
type: 'raw';
|
27
27
|
isRequired: true;
|
28
28
|
options: {
|
@@ -30,7 +30,7 @@ declare module '@sprucelabs/spruce-core-schemas/build/.spruce/schemas/core.schem
|
|
30
30
|
};
|
31
31
|
};
|
32
32
|
/** . */
|
33
|
-
|
33
|
+
args: {
|
34
34
|
type: 'raw';
|
35
35
|
options: {
|
36
36
|
valueType: `Record<string, any>`;
|
package/build/esm/.spruce/schemas/spruceTestFixtures/v2021_07_19/testRouterEmitPayload.schema.js
CHANGED
@@ -6,23 +6,25 @@ const testRouterEmitPayloadSchema = {
|
|
6
6
|
name: 'Test Router Emit payload',
|
7
7
|
fields: {
|
8
8
|
/** . */
|
9
|
-
|
9
|
+
id: {
|
10
10
|
type: 'text',
|
11
11
|
isRequired: true,
|
12
|
-
options: undefined
|
12
|
+
options: undefined,
|
13
13
|
},
|
14
14
|
/** . */
|
15
|
-
|
15
|
+
vc: {
|
16
16
|
type: 'raw',
|
17
17
|
isRequired: true,
|
18
|
-
options: {
|
18
|
+
options: {
|
19
|
+
valueType: `HeartwoodViewController.SkillViewController`,
|
20
|
+
},
|
19
21
|
},
|
20
22
|
/** . */
|
21
|
-
|
23
|
+
args: {
|
22
24
|
type: 'raw',
|
23
|
-
options: { valueType: `Record<string, any
|
25
|
+
options: { valueType: `Record<string, any>` },
|
24
26
|
},
|
25
|
-
}
|
27
|
+
},
|
26
28
|
};
|
27
29
|
SchemaRegistry.getInstance().trackSchema(testRouterEmitPayloadSchema);
|
28
30
|
export default testRouterEmitPayloadSchema;
|
@@ -34,9 +34,13 @@ export default class ClientProxyDecorator {
|
|
34
34
|
emit: (eventName, targetAndPayload, cb) => __awaiter(this, void 0, void 0, function* () {
|
35
35
|
let builtTp = yield this.mixinProxyToken(token, targetAndPayload);
|
36
36
|
return client.emit(eventName, builtTp, cb);
|
37
|
-
}),
|
37
|
+
}), emitAndFlattenResponses: (
|
38
38
|
//@ts-ignore
|
39
|
-
|
39
|
+
eventName,
|
40
|
+
//@ts-ignore
|
41
|
+
targetAndPayload,
|
42
|
+
//@ts-ignore
|
43
|
+
cb) => __awaiter(this, void 0, void 0, function* () {
|
40
44
|
let builtTp = yield this.mixinProxyToken(token, targetAndPayload);
|
41
45
|
return client.emitAndFlattenResponses(eventName, builtTp, cb);
|
42
46
|
}) });
|
@@ -224,7 +224,9 @@ let OrganizationFixtureTest = class OrganizationFixtureTest extends AbstractSpru
|
|
224
224
|
}
|
225
225
|
static canPassPersonFixture() {
|
226
226
|
const personFixture = this.Fixture('person');
|
227
|
-
const orgFixture = this.Fixture('organization', {
|
227
|
+
const orgFixture = this.Fixture('organization', {
|
228
|
+
people: personFixture,
|
229
|
+
});
|
228
230
|
//@ts-ignore
|
229
231
|
assert.isEqual(orgFixture.people, personFixture);
|
230
232
|
}
|
@@ -60,7 +60,9 @@ export default class PhoneNumberIncrementorTest extends AbstractSpruceFixtureTes
|
|
60
60
|
}
|
61
61
|
static generatesExpectedNumbers(expected) {
|
62
62
|
return __awaiter(this, void 0, void 0, function* () {
|
63
|
-
const numbers = yield this.generate({
|
63
|
+
const numbers = yield this.generate({
|
64
|
+
totalToGenerate: expected.length,
|
65
|
+
});
|
64
66
|
assert.isEqualDeep(numbers, expected);
|
65
67
|
});
|
66
68
|
}
|
@@ -83,9 +85,7 @@ __decorate([
|
|
83
85
|
'totalToGenerate',
|
84
86
|
]),
|
85
87
|
test('throws if totalToGenerate options missing', { startingPhone: '234234' }, ['totalToGenerate']),
|
86
|
-
test('throws if startingPhone options missing', { totalToGenerate: 1234 }, [
|
87
|
-
'startingPhone',
|
88
|
-
])
|
88
|
+
test('throws if startingPhone options missing', { totalToGenerate: 1234 }, ['startingPhone'])
|
89
89
|
], PhoneNumberIncrementorTest, "throwsWithMissingOptions", null);
|
90
90
|
__decorate([
|
91
91
|
test('throws if phone is 234234', '234234'),
|
@@ -27,7 +27,9 @@ let AuthenticatingAsAPersonTest = class AuthenticatingAsAPersonTest extends Abst
|
|
27
27
|
static canAuthenticateAsAPerson() {
|
28
28
|
return __awaiter(this, void 0, void 0, function* () {
|
29
29
|
const { token, person } = yield this.people.loginAsDemoPerson();
|
30
|
-
const { person: person2 } = yield fake
|
30
|
+
const { person: person2 } = yield fake
|
31
|
+
.getClient()
|
32
|
+
.authenticate({ token });
|
31
33
|
assert.isEqualDeep(person, person2);
|
32
34
|
});
|
33
35
|
}
|
@@ -220,7 +220,8 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
|
|
220
220
|
const [{ roles }] = yield this.listRolesForPerson(personId);
|
221
221
|
assert.isEqualDeep(roles.sort((a, b) => (a.id > b.id ? 1 : -1)), this.fakedRoles
|
222
222
|
.filter((r) => r.base === 'owner' ||
|
223
|
-
(r.base === 'teammate' &&
|
223
|
+
(r.base === 'teammate' &&
|
224
|
+
r.organizationId === organizationId))
|
224
225
|
.sort((a, b) => (a.id > b.id ? 1 : -1)));
|
225
226
|
});
|
226
227
|
}
|
@@ -287,7 +288,9 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
|
|
287
288
|
}
|
288
289
|
static callingRegisterProxyTokenOnAnonClientDoesNotThrough() {
|
289
290
|
return __awaiter(this, void 0, void 0, function* () {
|
290
|
-
const client = yield this.mercury.connectToApi({
|
291
|
+
const client = yield this.mercury.connectToApi({
|
292
|
+
shouldReUseClient: false,
|
293
|
+
});
|
291
294
|
yield client.emitAndFlattenResponses('register-proxy-token::v2020_12_25');
|
292
295
|
});
|
293
296
|
}
|
@@ -49,7 +49,9 @@ let WhoAmITest = class WhoAmITest extends AbstractSpruceFixtureTest {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
50
50
|
this.auth = this.views.getAuthenticator();
|
51
51
|
yield fake.getClient().emitAndFlattenResponses('whoami::v2020_12_25');
|
52
|
-
this.views
|
52
|
+
this.views
|
53
|
+
.getAuthenticator()
|
54
|
+
.addEventListener('did-login', () => __awaiter(this, void 0, void 0, function* () {
|
53
55
|
this.didLoginCount++;
|
54
56
|
}));
|
55
57
|
});
|
@@ -107,8 +107,9 @@ let SeedingDataTest = class SeedingDataTest extends AbstractSpruceFixtureTest {
|
|
107
107
|
}
|
108
108
|
static throwsWhenSeedingWithoutCount() {
|
109
109
|
return __awaiter(this, void 0, void 0, function* () {
|
110
|
+
const err = yield assert.doesThrowAsync(() =>
|
110
111
|
//@ts-ignore
|
111
|
-
|
112
|
+
this.fixture.seedAccount({}));
|
112
113
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
113
114
|
parameters: ['totalLocations'],
|
114
115
|
});
|
@@ -147,9 +148,8 @@ let SeedingDataTest = class SeedingDataTest extends AbstractSpruceFixtureTest {
|
|
147
148
|
var _a;
|
148
149
|
const _b = yield this.seedLocations(Object.assign({ totalLocations: 1, startingPhone: DEMO_NUMBER_SEED_FIXTURE_STARTING_PHONE }, options)), { locations } = _b, rest = __rest(_b, ["locations"]);
|
149
150
|
const withoutOwner = yield this.listPeople(locations[0], base);
|
150
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
151
151
|
const withoutOwnerCleaned = withoutOwner.map((_a) => {
|
152
|
-
var { roleIds } = _a, rest = __rest(_a, ["roleIds"]);
|
152
|
+
var { roleIds: _ } = _a, rest = __rest(_a, ["roleIds"]);
|
153
153
|
return rest;
|
154
154
|
});
|
155
155
|
//@ts-ignore
|
@@ -77,7 +77,9 @@ let UsingDecoratorsToInstallSkills = class UsingDecoratorsToInstallSkills extend
|
|
77
77
|
static doesNotEmitDidInstall() {
|
78
78
|
return __awaiter(this, void 0, void 0, function* () {
|
79
79
|
let passedPayload;
|
80
|
-
yield login
|
80
|
+
yield login
|
81
|
+
.getClient()
|
82
|
+
.on('install-skill::v2020_12_25', ({ payload }) => {
|
81
83
|
passedPayload = payload;
|
82
84
|
return {};
|
83
85
|
});
|
@@ -449,7 +449,9 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
|
|
449
449
|
}
|
450
450
|
static canSetMercuryClient() {
|
451
451
|
return __awaiter(this, void 0, void 0, function* () {
|
452
|
-
const client = yield this.mercury.connectToApi({
|
452
|
+
const client = yield this.mercury.connectToApi({
|
453
|
+
shouldReUseClient: false,
|
454
|
+
});
|
453
455
|
this.fixture.setClient(client);
|
454
456
|
//@ts-ignore
|
455
457
|
assert.isEqual(ViewFixture.viewClient, client);
|
package/build/esm/__tests__/testDirsAndFiles/one-good-store-skill/build/stores/Good.store.js
CHANGED
@@ -13,8 +13,8 @@ const fullSchema = buildSchema({
|
|
13
13
|
id: 'goodFull',
|
14
14
|
fields: {
|
15
15
|
firstName: {
|
16
|
-
type: 'text'
|
17
|
-
}
|
16
|
+
type: 'text',
|
17
|
+
},
|
18
18
|
},
|
19
19
|
});
|
20
20
|
export default class GoodStore extends AbstractStore {
|
@@ -34,7 +34,7 @@ export default class GoodStore extends AbstractStore {
|
|
34
34
|
return __awaiter(this, void 0, void 0, function* () {
|
35
35
|
GoodStore.seedParams = rest;
|
36
36
|
yield Promise.all(new Array(options.totalToSeed).fill(0).map(() => this.createOne({
|
37
|
-
firstName: 'hola!'
|
37
|
+
firstName: 'hola!',
|
38
38
|
})));
|
39
39
|
});
|
40
40
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AbstractSkillViewController } from
|
1
|
+
import { AbstractSkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
export default class BookSkillViewController extends AbstractSkillViewController {
|
3
3
|
static id: string;
|
4
4
|
render(): any;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { AbstractSkillViewController, SkillViewControllerLoadOptions, SpruceSchemas } from
|
1
|
+
import { AbstractSkillViewController, SkillViewControllerLoadOptions, SpruceSchemas } from '@sprucelabs/heartwood-view-controllers';
|
2
2
|
export default class SpySkillViewController extends AbstractSkillViewController {
|
3
3
|
static id: string;
|
4
4
|
loads: SkillViewControllerLoadOptions[];
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
8
8
|
});
|
9
9
|
};
|
10
|
-
import { AbstractSkillViewController } from '@sprucelabs/heartwood-view-controllers';
|
10
|
+
import { AbstractSkillViewController, } from '@sprucelabs/heartwood-view-controllers';
|
11
11
|
class SpySkillViewController extends AbstractSkillViewController {
|
12
12
|
constructor() {
|
13
13
|
super(...arguments);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import BaseSpruceError from '@sprucelabs/error';
|
2
|
-
import ErrorOptions from
|
2
|
+
import ErrorOptions from './../.spruce/errors/options.types';
|
3
3
|
export default class SpruceError extends BaseSpruceError<ErrorOptions> {
|
4
4
|
friendlyMessage(): string;
|
5
5
|
}
|
package/build/esm/index.d.ts
CHANGED
@@ -28,4 +28,4 @@ export { default as FakeAuthorizer } from './tests/FakeAuthorizer';
|
|
28
28
|
*/
|
29
29
|
export { default as phoneNumberIncrementer } from './utilities/phoneNumberIncrementor';
|
30
30
|
export { default as phoneNumberIncrementor } from './utilities/phoneNumberIncrementor';
|
31
|
-
export * from
|
31
|
+
export * from './.spruce/schemas/schemas.types';
|
@@ -124,8 +124,9 @@ fake.login = (phone = '555-000-0000') => {
|
|
124
124
|
ViewFixture.resetAuth();
|
125
125
|
try {
|
126
126
|
const auth = Class.views.getAuthenticator();
|
127
|
+
auth.setSessionToken(
|
127
128
|
//@ts-ignore
|
128
|
-
|
129
|
+
Class.fakedClient.auth.token, Class.fakedPerson);
|
129
130
|
}
|
130
131
|
catch (_d) {
|
131
132
|
//hits if not in skill because cant find nameplace
|
@@ -168,7 +169,10 @@ function loginUsingViewsFallingBackToPeople(Class, phone) {
|
|
168
169
|
person = p;
|
169
170
|
client = c;
|
170
171
|
}
|
171
|
-
return {
|
172
|
+
return {
|
173
|
+
person: Class.fakedPeople.find((p) => p.id === person.id),
|
174
|
+
client,
|
175
|
+
};
|
172
176
|
});
|
173
177
|
}
|
174
178
|
function givePersonName(person) {
|
@@ -291,7 +295,9 @@ function getPersonById(Class, personId, shouldThrowWhenNotFound = true) {
|
|
291
295
|
function fakeUpdatePerson(Class) {
|
292
296
|
return __awaiter(this, void 0, void 0, function* () {
|
293
297
|
yield eventFaker.on('update-person::v2020_12_25', ({ target, source, payload }) => {
|
294
|
-
const person = Class.fakedPeople.find((p) => (target === null || target === void 0 ? void 0 : target.personId)
|
298
|
+
const person = Class.fakedPeople.find((p) => (target === null || target === void 0 ? void 0 : target.personId)
|
299
|
+
? p.id === (target === null || target === void 0 ? void 0 : target.personId)
|
300
|
+
: p.id === (source === null || source === void 0 ? void 0 : source.personId));
|
295
301
|
if (!person) {
|
296
302
|
throw new SpruceError({
|
297
303
|
code: 'INVALID_TARGET',
|
@@ -317,7 +323,8 @@ function fakeListRoles(Class) {
|
|
317
323
|
if (personId) {
|
318
324
|
const personRoles = Class.fakedPeopleRoles
|
319
325
|
.filter((p) => p.personId === personId &&
|
320
|
-
((p.organizationId &&
|
326
|
+
((p.organizationId &&
|
327
|
+
p.organizationId === organizationId) ||
|
321
328
|
(p.locationId && p.locationId === locationId) ||
|
322
329
|
(!locationId && !organizationId)))
|
323
330
|
.map((pr) => getRoleById(Class, pr.roleId));
|
@@ -368,7 +375,8 @@ function fakeListLocations(Class) {
|
|
368
375
|
return __awaiter(this, void 0, void 0, function* () {
|
369
376
|
yield eventFaker.on('list-locations::v2020_12_25', ({ target, payload }) => {
|
370
377
|
return {
|
371
|
-
locations: applyPaging(Class._fakedLocations, payload).filter((l) => !(target === null || target === void 0 ? void 0 : target.organizationId) ||
|
378
|
+
locations: applyPaging(Class._fakedLocations, payload).filter((l) => !(target === null || target === void 0 ? void 0 : target.organizationId) ||
|
379
|
+
l.organizationId === (target === null || target === void 0 ? void 0 : target.organizationId)),
|
372
380
|
};
|
373
381
|
});
|
374
382
|
});
|
@@ -597,7 +605,9 @@ function fakeWhoAmI(Class) {
|
|
597
605
|
skill,
|
598
606
|
person,
|
599
607
|
},
|
600
|
-
type: person || skill
|
608
|
+
type: person || skill
|
609
|
+
? 'authenticated'
|
610
|
+
: 'anonymous',
|
601
611
|
};
|
602
612
|
});
|
603
613
|
});
|
@@ -77,8 +77,9 @@ class FixtureFactory {
|
|
77
77
|
break;
|
78
78
|
}
|
79
79
|
case 'skill': {
|
80
|
+
const personFixture =
|
80
81
|
//@ts-ignore
|
81
|
-
|
82
|
+
(_b = options === null || options === void 0 ? void 0 : options.personFixture) !== null && _b !== void 0 ? _b : this.Fixture('person');
|
82
83
|
fixture = new SkillFixture({
|
83
84
|
personFixture,
|
84
85
|
connectToApi: mercuryFixture.getConnectFactory(),
|
@@ -98,8 +99,9 @@ class FixtureFactory {
|
|
98
99
|
roles: this.Fixture('role'),
|
99
100
|
//@ts-ignore
|
100
101
|
people: (_c = options === null || options === void 0 ? void 0 : options.people) !== null && _c !== void 0 ? _c : this.Fixture('person'),
|
102
|
+
organizations:
|
101
103
|
//@ts-ignore
|
102
|
-
|
104
|
+
(_d = options === null || options === void 0 ? void 0 : options.organizations) !== null && _d !== void 0 ? _d : this.Fixture('organization'),
|
103
105
|
});
|
104
106
|
break;
|
105
107
|
}
|
@@ -124,7 +124,8 @@ class MercuryFixture {
|
|
124
124
|
}
|
125
125
|
static beforeAll() {
|
126
126
|
var _a, _b;
|
127
|
-
this.originalHost =
|
127
|
+
this.originalHost =
|
128
|
+
(_b = (_a = process.env.TEST_HOST) !== null && _a !== void 0 ? _a : process.env.HOST) !== null && _b !== void 0 ? _b : TEST_HOST;
|
128
129
|
}
|
129
130
|
static beforeEach(cwd) {
|
130
131
|
return __awaiter(this, void 0, void 0, function* () {
|
@@ -146,9 +147,10 @@ class MercuryFixture {
|
|
146
147
|
const auth = AuthService.Auth(cwd);
|
147
148
|
const namespace = (_a = auth.getCurrentSkill()) === null || _a === void 0 ? void 0 : _a.slug;
|
148
149
|
if (namespace) {
|
149
|
-
MercuryTestClient.setNamespacesThatMustBeHandledLocally([
|
150
|
+
MercuryTestClient.setNamespacesThatMustBeHandledLocally([
|
151
|
+
namespace,
|
152
|
+
]);
|
150
153
|
}
|
151
|
-
// eslint-disable-next-line no-empty
|
152
154
|
}
|
153
155
|
catch (_b) { }
|
154
156
|
});
|
@@ -53,7 +53,8 @@ export default class PersonFixture {
|
|
53
53
|
return __awaiter(this, void 0, void 0, function* () {
|
54
54
|
var _a, _b, _c;
|
55
55
|
if (this.lastLoggedIn &&
|
56
|
-
(!phone ||
|
56
|
+
(!phone ||
|
57
|
+
formatPhoneNumber(phone) === this.lastLoggedIn.person.phone)) {
|
57
58
|
return this.lastLoggedIn;
|
58
59
|
}
|
59
60
|
const client = (yield this.connectToApi({
|
@@ -30,7 +30,8 @@ class ViewFixture {
|
|
30
30
|
const { connectToApi, people, fixtureFactory, vcDir, cwd, namespace, proxyDecorator, permissions, } = options;
|
31
31
|
this.connectToApi = connectToApi;
|
32
32
|
this.people = people;
|
33
|
-
this.vcDir =
|
33
|
+
this.vcDir =
|
34
|
+
vcDir !== null && vcDir !== void 0 ? vcDir : diskUtil.resolvePath(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), 'build');
|
34
35
|
this.controllerMap = options === null || options === void 0 ? void 0 : options.controllerMap;
|
35
36
|
this.namespace = namespace;
|
36
37
|
this.proxyDecorator = proxyDecorator;
|
package/build/index.d.ts
CHANGED
@@ -28,4 +28,4 @@ export { default as FakeAuthorizer } from './tests/FakeAuthorizer';
|
|
28
28
|
*/
|
29
29
|
export { default as phoneNumberIncrementer } from './utilities/phoneNumberIncrementor';
|
30
30
|
export { default as phoneNumberIncrementor } from './utilities/phoneNumberIncrementor';
|
31
|
-
export * from
|
31
|
+
export * from './.spruce/schemas/schemas.types';
|