@sprucelabs/spruce-test-fixtures 44.2.15 → 44.2.18
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/ClientProxyDecorator.js +2 -1
- package/build/esm/ClientProxyDecorator.js +2 -1
- package/build/esm/tests/AbstractSpruceFixtureTest.d.ts +1 -1
- package/build/esm/tests/decorators/fake.js +29 -28
- package/build/esm/tests/fixtures/PersonFixture.js +1 -1
- package/build/tests/AbstractSpruceFixtureTest.d.ts +1 -1
- package/build/tests/decorators/fake.js +29 -28
- package/build/tests/fixtures/PersonFixture.js +1 -1
- package/package.json +17 -17
|
@@ -22,7 +22,7 @@ class ClientProxyDecorator {
|
|
|
22
22
|
delete this.instance;
|
|
23
23
|
}
|
|
24
24
|
decorateEmitToPassProxyToken(client, token) {
|
|
25
|
-
const newClient = Object.assign(Object.assign({}, client), {
|
|
25
|
+
const newClient = Object.assign(Object.assign({}, client), { proxyToken: token,
|
|
26
26
|
//@ts-ignore
|
|
27
27
|
emit: async (eventName, targetAndPayload, cb) => {
|
|
28
28
|
let builtTp = await this.mixinProxyToken(token, targetAndPayload);
|
|
@@ -34,6 +34,7 @@ class ClientProxyDecorator {
|
|
|
34
34
|
return client.emitAndFlattenResponses(eventName, builtTp, cb);
|
|
35
35
|
} });
|
|
36
36
|
spruce_skill_utils_1.functionDelegationUtil.delegateFunctionCalls(newClient, client);
|
|
37
|
+
newClient.getProxyToken = () => token;
|
|
37
38
|
return newClient;
|
|
38
39
|
}
|
|
39
40
|
async mixinProxyToken(token, targetAndPayload) {
|
|
@@ -29,7 +29,7 @@ export default class ClientProxyDecorator {
|
|
|
29
29
|
delete this.instance;
|
|
30
30
|
}
|
|
31
31
|
decorateEmitToPassProxyToken(client, token) {
|
|
32
|
-
const newClient = Object.assign(Object.assign({}, client), {
|
|
32
|
+
const newClient = Object.assign(Object.assign({}, client), { proxyToken: token,
|
|
33
33
|
//@ts-ignore
|
|
34
34
|
emit: (eventName, targetAndPayload, cb) => __awaiter(this, void 0, void 0, function* () {
|
|
35
35
|
let builtTp = yield this.mixinProxyToken(token, targetAndPayload);
|
|
@@ -41,6 +41,7 @@ export default class ClientProxyDecorator {
|
|
|
41
41
|
return client.emitAndFlattenResponses(eventName, builtTp, cb);
|
|
42
42
|
}) });
|
|
43
43
|
functionDelegationUtil.delegateFunctionCalls(newClient, client);
|
|
44
|
+
newClient.getProxyToken = () => token;
|
|
44
45
|
return newClient;
|
|
45
46
|
}
|
|
46
47
|
mixinProxyToken(token, targetAndPayload) {
|
|
@@ -16,7 +16,7 @@ declare type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
|
|
|
16
16
|
declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
|
|
17
17
|
declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
|
|
18
18
|
export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
|
|
19
|
-
static
|
|
19
|
+
static fakedPerson: Person;
|
|
20
20
|
static fakedPeople: Person[];
|
|
21
21
|
static fakedTeammates: Person[];
|
|
22
22
|
static fakedOwners: Person[];
|
|
@@ -29,7 +29,6 @@ import AbstractSpruceFixtureTest from '../AbstractSpruceFixtureTest.js';
|
|
|
29
29
|
import eventFaker from '../eventFaker.js';
|
|
30
30
|
import generateRandomName from '../fixtures/generateRandomName.js';
|
|
31
31
|
import MercuryFixture from '../fixtures/MercuryFixture.js';
|
|
32
|
-
import ViewFixture from '../fixtures/ViewFixture.js';
|
|
33
32
|
import seed from './seed.js';
|
|
34
33
|
const strategies = {
|
|
35
34
|
organizations: seedOrganizations,
|
|
@@ -40,7 +39,8 @@ const strategies = {
|
|
|
40
39
|
groupManagers: buildSeeder('groupManagers'),
|
|
41
40
|
owners: buildSeeder('owners'),
|
|
42
41
|
};
|
|
43
|
-
function
|
|
42
|
+
function resetFakedRecords(Class) {
|
|
43
|
+
var _a, _b, _c;
|
|
44
44
|
if (shouldSkipNextReset) {
|
|
45
45
|
shouldSkipNextReset = false;
|
|
46
46
|
return;
|
|
@@ -55,10 +55,12 @@ function resetFakes(Class) {
|
|
|
55
55
|
Class.fakedGroupManagers = [];
|
|
56
56
|
Class.fakedGuests = [];
|
|
57
57
|
Class.fakedRoles = [];
|
|
58
|
-
Class.fakedPeople = [];
|
|
58
|
+
Class.fakedPeople = ((_a = Class.fakedPeople) === null || _a === void 0 ? void 0 : _a[0]) ? [Class.fakedPeople[0]] : [];
|
|
59
59
|
Class.fakedSkills = [];
|
|
60
|
-
Class.fakedTokens = [];
|
|
61
|
-
Class.fakedProxyTokens = []
|
|
60
|
+
Class.fakedTokens = ((_b = Class.fakedTokens) === null || _b === void 0 ? void 0 : _b[0]) ? [Class.fakedTokens[0]] : [];
|
|
61
|
+
Class.fakedProxyTokens = ((_c = Class.fakedProxyTokens) === null || _c === void 0 ? void 0 : _c[0])
|
|
62
|
+
? [Class.fakedProxyTokens[0]]
|
|
63
|
+
: [];
|
|
62
64
|
}
|
|
63
65
|
export default function fake(target, total) {
|
|
64
66
|
assertOptions({ target, total }, ['target', 'total']);
|
|
@@ -67,7 +69,7 @@ export default function fake(target, total) {
|
|
|
67
69
|
const Class = TestClass;
|
|
68
70
|
const bound = (_b = (_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === null || _a === void 0 ? void 0 : _a.bind) === null || _b === void 0 ? void 0 : _b.call(_a, Class);
|
|
69
71
|
descriptor.value = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
-
assert.isTruthy(Class.
|
|
72
|
+
assert.isTruthy(Class.fakedPerson, `You gotta @faker.login(...) before you can create fake '${target}'!`);
|
|
71
73
|
const strategy = strategies[target];
|
|
72
74
|
assert.isTruthy(strategy, `Faking ${target} is not ready yet!`);
|
|
73
75
|
yield (strategy === null || strategy === void 0 ? void 0 : strategy(Class, total));
|
|
@@ -78,6 +80,7 @@ export default function fake(target, total) {
|
|
|
78
80
|
fake.login = (phone = '555-000-0000') => {
|
|
79
81
|
assert.isTruthy(phone, `You need to pass a phone to 'faker.login(...)'`);
|
|
80
82
|
assert.isTrue(isValidNumber(phone), `'${phone}' is not a valid phone. Try something like: 555-000-0000`);
|
|
83
|
+
MercuryFixture.setShouldAutomaticallyClearDefaultClient(false);
|
|
81
84
|
MercuryTestClient.setShouldRequireLocalListeners(true);
|
|
82
85
|
MercuryClientFactory.setIsTestMode(true);
|
|
83
86
|
seed.disableResettingTestClient();
|
|
@@ -96,29 +99,26 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
96
99
|
MercuryFixture.beforeEach = (...args) => __awaiter(this, void 0, void 0, function* () {
|
|
97
100
|
//@ts-ignore
|
|
98
101
|
yield old(...args);
|
|
99
|
-
yield
|
|
100
|
-
MercuryFixture.setDefaultClient(Class.fakedOwnerClient);
|
|
102
|
+
yield setupFakeListeners(Class);
|
|
101
103
|
});
|
|
102
104
|
}
|
|
103
105
|
Class.beforeAll = () => __awaiter(this, void 0, void 0, function* () {
|
|
104
106
|
yield (beforeAll === null || beforeAll === void 0 ? void 0 : beforeAll());
|
|
105
|
-
|
|
106
|
-
yield
|
|
107
|
+
resetFakedRecords(Class);
|
|
108
|
+
yield setupFakeListeners(Class);
|
|
107
109
|
yield login(Class, phone);
|
|
108
|
-
MercuryFixture.setDefaultClient(Class.
|
|
110
|
+
MercuryFixture.setDefaultClient(Class.fakedClient);
|
|
109
111
|
});
|
|
110
112
|
Class.afterEach = () => __awaiter(this, void 0, void 0, function* () {
|
|
111
|
-
yield
|
|
113
|
+
yield setupFakeListeners(Class);
|
|
112
114
|
yield (afterEach === null || afterEach === void 0 ? void 0 : afterEach());
|
|
113
115
|
});
|
|
114
116
|
Class.beforeEach = () => __awaiter(this, void 0, void 0, function* () {
|
|
115
|
-
|
|
116
|
-
yield
|
|
117
|
-
resetFakes(Class);
|
|
117
|
+
resetFakedRecords(Class);
|
|
118
|
+
yield setupFakeListeners(Class);
|
|
118
119
|
if (!TestClass.cwd) {
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
|
-
yield login(Class, phone);
|
|
122
122
|
shouldPassHookCalls && (yield (beforeEach === null || beforeEach === void 0 ? void 0 : beforeEach()));
|
|
123
123
|
});
|
|
124
124
|
};
|
|
@@ -136,10 +136,10 @@ function login(Class, phone) {
|
|
|
136
136
|
if (!person.firstName) {
|
|
137
137
|
givePersonName(person);
|
|
138
138
|
}
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Class.
|
|
142
|
-
Class.
|
|
139
|
+
//@ts-ignore
|
|
140
|
+
client.auth.person = person;
|
|
141
|
+
Class.fakedClient = client;
|
|
142
|
+
Class.fakedPerson = person;
|
|
143
143
|
});
|
|
144
144
|
}
|
|
145
145
|
function loginUsingViewsFallingBackToPeople(Class, phone) {
|
|
@@ -156,7 +156,8 @@ function loginUsingViewsFallingBackToPeople(Class, phone) {
|
|
|
156
156
|
person = p;
|
|
157
157
|
client = c;
|
|
158
158
|
}
|
|
159
|
-
|
|
159
|
+
yield client.registerProxyToken();
|
|
160
|
+
return { person: Class.fakedPeople.find((p) => p.id === person.id), client };
|
|
160
161
|
});
|
|
161
162
|
}
|
|
162
163
|
function givePersonName(person) {
|
|
@@ -165,7 +166,7 @@ function givePersonName(person) {
|
|
|
165
166
|
person.firstName = names.firstName;
|
|
166
167
|
person.lastName = names.lastName;
|
|
167
168
|
}
|
|
168
|
-
function
|
|
169
|
+
function setupFakeListeners(Class) {
|
|
169
170
|
return __awaiter(this, void 0, void 0, function* () {
|
|
170
171
|
yield Promise.all([
|
|
171
172
|
fakeSkillLifecycleEvents(Class),
|
|
@@ -397,7 +398,7 @@ function fakeCreateLocation(Class) {
|
|
|
397
398
|
addPersonAsRoleToLocationOrOrg({
|
|
398
399
|
Class,
|
|
399
400
|
roleId: role.id,
|
|
400
|
-
person: Class.
|
|
401
|
+
person: Class.fakedPerson,
|
|
401
402
|
locationId: location.id,
|
|
402
403
|
});
|
|
403
404
|
}
|
|
@@ -418,7 +419,7 @@ function fakeCreateOrganization(Class) {
|
|
|
418
419
|
Class,
|
|
419
420
|
organizationId: organization.id,
|
|
420
421
|
roleId: roles.find((r) => r.base === 'owner').id,
|
|
421
|
-
person: Class.
|
|
422
|
+
person: Class.fakedPerson,
|
|
422
423
|
});
|
|
423
424
|
return {
|
|
424
425
|
organization,
|
|
@@ -449,7 +450,7 @@ function fakeSkillLifecycleEvents(Class) {
|
|
|
449
450
|
process.env.SKILL_API_KEY = process.env.SKILL_API_KEY || generateId();
|
|
450
451
|
yield eventFaker.on('register-skill::v2020_12_25', ({ payload }) => {
|
|
451
452
|
var _a;
|
|
452
|
-
const skill = Object.assign(Object.assign({ apiKey: generateId(), creators: [{ personId: Class.
|
|
453
|
+
const skill = Object.assign(Object.assign({ apiKey: generateId(), creators: [{ personId: Class.fakedPerson.id }], dateCreated: new Date().getTime(), id: generateId() }, payload), { slug: (_a = payload.slug) !== null && _a !== void 0 ? _a : generateId() });
|
|
453
454
|
Class.fakedSkills.unshift(skill);
|
|
454
455
|
return {
|
|
455
456
|
skill,
|
|
@@ -601,8 +602,8 @@ function fakeAuthenticationEvents(Class) {
|
|
|
601
602
|
let person = Class.fakedPeople.find((p) => p.phone === formattedPhone);
|
|
602
603
|
if (!person) {
|
|
603
604
|
person =
|
|
604
|
-
((_a = Class.
|
|
605
|
-
? Class.
|
|
605
|
+
((_a = Class.fakedPerson) === null || _a === void 0 ? void 0 : _a.phone) === formattedPhone
|
|
606
|
+
? Class.fakedPerson
|
|
606
607
|
: {
|
|
607
608
|
id: generateId(),
|
|
608
609
|
casualName: 'friend',
|
|
@@ -667,7 +668,7 @@ function fakeAuthenticationEvents(Class) {
|
|
|
667
668
|
}
|
|
668
669
|
const person = getPersonById(Class, match.personId);
|
|
669
670
|
return {
|
|
670
|
-
type: '
|
|
671
|
+
type: 'authenticated',
|
|
671
672
|
auth: {
|
|
672
673
|
person,
|
|
673
674
|
},
|
|
@@ -53,7 +53,7 @@ export default class PersonFixture {
|
|
|
53
53
|
var _a, _b, _c;
|
|
54
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
55
55
|
if (this.lastLoggedIn &&
|
|
56
|
-
(!phone || phone === this.lastLoggedIn.person.phone)) {
|
|
56
|
+
(!phone || formatPhoneNumber(phone) === this.lastLoggedIn.person.phone)) {
|
|
57
57
|
return this.lastLoggedIn;
|
|
58
58
|
}
|
|
59
59
|
const client = (yield this.connectToApi({
|
|
@@ -16,7 +16,7 @@ declare type Role = SpruceSchemas.Spruce.v2020_07_22.Role;
|
|
|
16
16
|
declare type Skill = SpruceSchemas.Spruce.v2020_07_22.Skill;
|
|
17
17
|
declare type Organization = SpruceSchemas.Spruce.v2020_07_22.Organization;
|
|
18
18
|
export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTest {
|
|
19
|
-
static
|
|
19
|
+
static fakedPerson: Person;
|
|
20
20
|
static fakedPeople: Person[];
|
|
21
21
|
static fakedTeammates: Person[];
|
|
22
22
|
static fakedOwners: Person[];
|
|
@@ -26,7 +26,6 @@ const AbstractSpruceFixtureTest_1 = __importDefault(require("../AbstractSpruceFi
|
|
|
26
26
|
const eventFaker_1 = __importDefault(require("../eventFaker"));
|
|
27
27
|
const generateRandomName_1 = __importDefault(require("../fixtures/generateRandomName"));
|
|
28
28
|
const MercuryFixture_1 = __importDefault(require("../fixtures/MercuryFixture"));
|
|
29
|
-
const ViewFixture_1 = __importDefault(require("../fixtures/ViewFixture"));
|
|
30
29
|
const seed_1 = __importDefault(require("./seed"));
|
|
31
30
|
const strategies = {
|
|
32
31
|
organizations: seedOrganizations,
|
|
@@ -37,7 +36,8 @@ const strategies = {
|
|
|
37
36
|
groupManagers: buildSeeder('groupManagers'),
|
|
38
37
|
owners: buildSeeder('owners'),
|
|
39
38
|
};
|
|
40
|
-
function
|
|
39
|
+
function resetFakedRecords(Class) {
|
|
40
|
+
var _a, _b, _c;
|
|
41
41
|
if (shouldSkipNextReset) {
|
|
42
42
|
shouldSkipNextReset = false;
|
|
43
43
|
return;
|
|
@@ -52,10 +52,12 @@ function resetFakes(Class) {
|
|
|
52
52
|
Class.fakedGroupManagers = [];
|
|
53
53
|
Class.fakedGuests = [];
|
|
54
54
|
Class.fakedRoles = [];
|
|
55
|
-
Class.fakedPeople = [];
|
|
55
|
+
Class.fakedPeople = ((_a = Class.fakedPeople) === null || _a === void 0 ? void 0 : _a[0]) ? [Class.fakedPeople[0]] : [];
|
|
56
56
|
Class.fakedSkills = [];
|
|
57
|
-
Class.fakedTokens = [];
|
|
58
|
-
Class.fakedProxyTokens = []
|
|
57
|
+
Class.fakedTokens = ((_b = Class.fakedTokens) === null || _b === void 0 ? void 0 : _b[0]) ? [Class.fakedTokens[0]] : [];
|
|
58
|
+
Class.fakedProxyTokens = ((_c = Class.fakedProxyTokens) === null || _c === void 0 ? void 0 : _c[0])
|
|
59
|
+
? [Class.fakedProxyTokens[0]]
|
|
60
|
+
: [];
|
|
59
61
|
}
|
|
60
62
|
function fake(target, total) {
|
|
61
63
|
(0, schema_1.assertOptions)({ target, total }, ['target', 'total']);
|
|
@@ -64,7 +66,7 @@ function fake(target, total) {
|
|
|
64
66
|
const Class = TestClass;
|
|
65
67
|
const bound = (_b = (_a = descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === null || _a === void 0 ? void 0 : _a.bind) === null || _b === void 0 ? void 0 : _b.call(_a, Class);
|
|
66
68
|
descriptor.value = async (...args) => {
|
|
67
|
-
test_1.assert.isTruthy(Class.
|
|
69
|
+
test_1.assert.isTruthy(Class.fakedPerson, `You gotta @faker.login(...) before you can create fake '${target}'!`);
|
|
68
70
|
const strategy = strategies[target];
|
|
69
71
|
test_1.assert.isTruthy(strategy, `Faking ${target} is not ready yet!`);
|
|
70
72
|
await (strategy === null || strategy === void 0 ? void 0 : strategy(Class, total));
|
|
@@ -76,6 +78,7 @@ exports.default = fake;
|
|
|
76
78
|
fake.login = (phone = '555-000-0000') => {
|
|
77
79
|
test_1.assert.isTruthy(phone, `You need to pass a phone to 'faker.login(...)'`);
|
|
78
80
|
test_1.assert.isTrue((0, schema_1.isValidNumber)(phone), `'${phone}' is not a valid phone. Try something like: 555-000-0000`);
|
|
81
|
+
MercuryFixture_1.default.setShouldAutomaticallyClearDefaultClient(false);
|
|
79
82
|
mercury_client_1.MercuryTestClient.setShouldRequireLocalListeners(true);
|
|
80
83
|
mercury_client_1.MercuryClientFactory.setIsTestMode(true);
|
|
81
84
|
seed_1.default.disableResettingTestClient();
|
|
@@ -94,29 +97,26 @@ fake.login = (phone = '555-000-0000') => {
|
|
|
94
97
|
MercuryFixture_1.default.beforeEach = async (...args) => {
|
|
95
98
|
//@ts-ignore
|
|
96
99
|
await old(...args);
|
|
97
|
-
await
|
|
98
|
-
MercuryFixture_1.default.setDefaultClient(Class.fakedOwnerClient);
|
|
100
|
+
await setupFakeListeners(Class);
|
|
99
101
|
};
|
|
100
102
|
}
|
|
101
103
|
Class.beforeAll = async () => {
|
|
102
104
|
await (beforeAll === null || beforeAll === void 0 ? void 0 : beforeAll());
|
|
103
|
-
|
|
104
|
-
await
|
|
105
|
+
resetFakedRecords(Class);
|
|
106
|
+
await setupFakeListeners(Class);
|
|
105
107
|
await login(Class, phone);
|
|
106
|
-
MercuryFixture_1.default.setDefaultClient(Class.
|
|
108
|
+
MercuryFixture_1.default.setDefaultClient(Class.fakedClient);
|
|
107
109
|
};
|
|
108
110
|
Class.afterEach = async () => {
|
|
109
|
-
await
|
|
111
|
+
await setupFakeListeners(Class);
|
|
110
112
|
await (afterEach === null || afterEach === void 0 ? void 0 : afterEach());
|
|
111
113
|
};
|
|
112
114
|
Class.beforeEach = async () => {
|
|
113
|
-
|
|
114
|
-
await
|
|
115
|
-
resetFakes(Class);
|
|
115
|
+
resetFakedRecords(Class);
|
|
116
|
+
await setupFakeListeners(Class);
|
|
116
117
|
if (!TestClass.cwd) {
|
|
117
118
|
return;
|
|
118
119
|
}
|
|
119
|
-
await login(Class, phone);
|
|
120
120
|
shouldPassHookCalls && (await (beforeEach === null || beforeEach === void 0 ? void 0 : beforeEach()));
|
|
121
121
|
};
|
|
122
122
|
};
|
|
@@ -133,10 +133,10 @@ async function login(Class, phone) {
|
|
|
133
133
|
if (!person.firstName) {
|
|
134
134
|
givePersonName(person);
|
|
135
135
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
Class.
|
|
139
|
-
Class.
|
|
136
|
+
//@ts-ignore
|
|
137
|
+
client.auth.person = person;
|
|
138
|
+
Class.fakedClient = client;
|
|
139
|
+
Class.fakedPerson = person;
|
|
140
140
|
}
|
|
141
141
|
async function loginUsingViewsFallingBackToPeople(Class, phone) {
|
|
142
142
|
let person;
|
|
@@ -151,7 +151,8 @@ async function loginUsingViewsFallingBackToPeople(Class, phone) {
|
|
|
151
151
|
person = p;
|
|
152
152
|
client = c;
|
|
153
153
|
}
|
|
154
|
-
|
|
154
|
+
await client.registerProxyToken();
|
|
155
|
+
return { person: Class.fakedPeople.find((p) => p.id === person.id), client };
|
|
155
156
|
}
|
|
156
157
|
function givePersonName(person) {
|
|
157
158
|
const names = (0, generateRandomName_1.default)();
|
|
@@ -159,7 +160,7 @@ function givePersonName(person) {
|
|
|
159
160
|
person.firstName = names.firstName;
|
|
160
161
|
person.lastName = names.lastName;
|
|
161
162
|
}
|
|
162
|
-
async function
|
|
163
|
+
async function setupFakeListeners(Class) {
|
|
163
164
|
await Promise.all([
|
|
164
165
|
fakeSkillLifecycleEvents(Class),
|
|
165
166
|
fakeGetPerson(Class),
|
|
@@ -370,7 +371,7 @@ async function fakeCreateLocation(Class) {
|
|
|
370
371
|
addPersonAsRoleToLocationOrOrg({
|
|
371
372
|
Class,
|
|
372
373
|
roleId: role.id,
|
|
373
|
-
person: Class.
|
|
374
|
+
person: Class.fakedPerson,
|
|
374
375
|
locationId: location.id,
|
|
375
376
|
});
|
|
376
377
|
}
|
|
@@ -389,7 +390,7 @@ async function fakeCreateOrganization(Class) {
|
|
|
389
390
|
Class,
|
|
390
391
|
organizationId: organization.id,
|
|
391
392
|
roleId: roles.find((r) => r.base === 'owner').id,
|
|
392
|
-
person: Class.
|
|
393
|
+
person: Class.fakedPerson,
|
|
393
394
|
});
|
|
394
395
|
return {
|
|
395
396
|
organization,
|
|
@@ -416,7 +417,7 @@ async function fakeSkillLifecycleEvents(Class) {
|
|
|
416
417
|
process.env.SKILL_API_KEY = process.env.SKILL_API_KEY || (0, test_utils_1.generateId)();
|
|
417
418
|
await eventFaker_1.default.on('register-skill::v2020_12_25', ({ payload }) => {
|
|
418
419
|
var _a;
|
|
419
|
-
const skill = Object.assign(Object.assign({ apiKey: (0, test_utils_1.generateId)(), creators: [{ personId: Class.
|
|
420
|
+
const skill = Object.assign(Object.assign({ apiKey: (0, test_utils_1.generateId)(), creators: [{ personId: Class.fakedPerson.id }], dateCreated: new Date().getTime(), id: (0, test_utils_1.generateId)() }, payload), { slug: (_a = payload.slug) !== null && _a !== void 0 ? _a : (0, test_utils_1.generateId)() });
|
|
420
421
|
Class.fakedSkills.unshift(skill);
|
|
421
422
|
return {
|
|
422
423
|
skill,
|
|
@@ -550,8 +551,8 @@ async function fakeAuthenticationEvents(Class) {
|
|
|
550
551
|
let person = Class.fakedPeople.find((p) => p.phone === formattedPhone);
|
|
551
552
|
if (!person) {
|
|
552
553
|
person =
|
|
553
|
-
((_a = Class.
|
|
554
|
-
? Class.
|
|
554
|
+
((_a = Class.fakedPerson) === null || _a === void 0 ? void 0 : _a.phone) === formattedPhone
|
|
555
|
+
? Class.fakedPerson
|
|
555
556
|
: {
|
|
556
557
|
id: (0, test_utils_1.generateId)(),
|
|
557
558
|
casualName: 'friend',
|
|
@@ -616,7 +617,7 @@ async function fakeAuthenticationEvents(Class) {
|
|
|
616
617
|
}
|
|
617
618
|
const person = getPersonById(Class, match.personId);
|
|
618
619
|
return {
|
|
619
|
-
type: '
|
|
620
|
+
type: 'authenticated',
|
|
620
621
|
auth: {
|
|
621
622
|
person,
|
|
622
623
|
},
|
|
@@ -44,7 +44,7 @@ class PersonFixture {
|
|
|
44
44
|
async loginAsDemoPerson(phone) {
|
|
45
45
|
var _a, _b, _c;
|
|
46
46
|
if (this.lastLoggedIn &&
|
|
47
|
-
(!phone || phone === this.lastLoggedIn.person.phone)) {
|
|
47
|
+
(!phone || (0, schema_1.formatPhoneNumber)(phone) === this.lastLoggedIn.person.phone)) {
|
|
48
48
|
return this.lastLoggedIn;
|
|
49
49
|
}
|
|
50
50
|
const client = (await this.connectToApi({
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "44.2.
|
|
16
|
+
"version": "44.2.18",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -62,29 +62,29 @@
|
|
|
62
62
|
"lint.tsc": "tsc -p . --noEmit"
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@sprucelabs/data-stores": "^17.0.
|
|
65
|
+
"@sprucelabs/data-stores": "^17.0.61",
|
|
66
66
|
"@sprucelabs/error": "^5.0.487",
|
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^86.13.
|
|
68
|
-
"@sprucelabs/mercury-client": "^31.0.
|
|
69
|
-
"@sprucelabs/mercury-core-events": "^12.0.
|
|
70
|
-
"@sprucelabs/mercury-event-emitter": "^31.0.
|
|
71
|
-
"@sprucelabs/schema": "^28.3.
|
|
72
|
-
"@sprucelabs/spruce-core-schemas": "^34.2.
|
|
73
|
-
"@sprucelabs/spruce-event-utils": "^27.0.
|
|
74
|
-
"@sprucelabs/spruce-skill-booter": "^44.2.
|
|
75
|
-
"@sprucelabs/spruce-skill-utils": "^26.3.
|
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^86.13.23",
|
|
68
|
+
"@sprucelabs/mercury-client": "^31.0.100",
|
|
69
|
+
"@sprucelabs/mercury-core-events": "^12.0.100",
|
|
70
|
+
"@sprucelabs/mercury-event-emitter": "^31.0.100",
|
|
71
|
+
"@sprucelabs/schema": "^28.3.17",
|
|
72
|
+
"@sprucelabs/spruce-core-schemas": "^34.2.19",
|
|
73
|
+
"@sprucelabs/spruce-event-utils": "^27.0.75",
|
|
74
|
+
"@sprucelabs/spruce-skill-booter": "^44.2.18",
|
|
75
|
+
"@sprucelabs/spruce-skill-utils": "^26.3.10",
|
|
76
76
|
"dotenv": "^16.0.1",
|
|
77
77
|
"unique-names-generator": "^4.7.1"
|
|
78
78
|
},
|
|
79
79
|
"devDependencies": {
|
|
80
|
-
"@sprucelabs/esm-postbuild": "^1.0.
|
|
81
|
-
"@sprucelabs/jest-json-reporter": "^6.0.
|
|
82
|
-
"@sprucelabs/jest-sheets-reporter": "^1.3.
|
|
83
|
-
"@sprucelabs/mercury-types": "^35.0.
|
|
80
|
+
"@sprucelabs/esm-postbuild": "^1.0.532",
|
|
81
|
+
"@sprucelabs/jest-json-reporter": "^6.0.431",
|
|
82
|
+
"@sprucelabs/jest-sheets-reporter": "^1.3.66",
|
|
83
|
+
"@sprucelabs/mercury-types": "^35.0.59",
|
|
84
84
|
"@sprucelabs/resolve-path-aliases": "^1.1.75",
|
|
85
85
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
86
86
|
"@sprucelabs/test": "^7.7.338",
|
|
87
|
-
"@sprucelabs/test-utils": "^3.1.
|
|
87
|
+
"@sprucelabs/test-utils": "^3.1.39",
|
|
88
88
|
"@types/node": "17.0.5",
|
|
89
89
|
"calendar-utils": "^0.9.0",
|
|
90
90
|
"chokidar-cli": "^3.0.0",
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
]
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "1323976991a02074eb7a1f916b02755b599ae8da"
|
|
135
135
|
}
|