@sprucelabs/spruce-test-fixtures 60.1.271 → 60.1.272

Sign up to get free protection for your applications and to get access to all the features.
@@ -45,8 +45,8 @@ export default class ClientProxyDecorator {
45
45
  return newClient;
46
46
  }
47
47
  mixinProxyToken(token, targetAndPayload) {
48
- var _a;
49
48
  return __awaiter(this, void 0, void 0, function* () {
49
+ var _a;
50
50
  const t = token || (yield ((_a = this.proxyTokenGenerator) === null || _a === void 0 ? void 0 : _a.call(this)));
51
51
  let builtTp = targetAndPayload;
52
52
  if (t) {
@@ -102,8 +102,8 @@ export default class FakingErrorResponsesTest extends AbstractSpruceFixtureTest
102
102
  });
103
103
  }
104
104
  static canCustomizeTheErrorPassedIn() {
105
- var _a;
106
105
  return __awaiter(this, void 0, void 0, function* () {
106
+ var _a;
107
107
  const error = new SpruceError({
108
108
  code: 'INVALID_TARGET',
109
109
  });
@@ -114,13 +114,13 @@ export default class PersonFixtureTest extends AbstractSpruceTest {
114
114
  assert.isEqual(client, client2);
115
115
  });
116
116
  }
117
- static listPeoplePassesThroughVars(expectedTarget, expectedPayload = {
118
- personIds: ['1234'],
119
- roleBases: ['1234'],
120
- roleIds: ['1234'],
121
- shouldIncludePrivateFields: true,
122
- }) {
123
- return __awaiter(this, void 0, void 0, function* () {
117
+ static listPeoplePassesThroughVars(expectedTarget_1) {
118
+ return __awaiter(this, arguments, void 0, function* (expectedTarget, expectedPayload = {
119
+ personIds: ['1234'],
120
+ roleBases: ['1234'],
121
+ roleIds: ['1234'],
122
+ shouldIncludePrivateFields: true,
123
+ }) {
124
124
  MercuryClientFactory.setIsTestMode(true);
125
125
  assert.isFunction(this.fixture.listPeople);
126
126
  const { client } = yield this.fixture.loginAsDemoPerson(DEMO_NUMBER_PERSON_FIXTURE);
@@ -31,8 +31,8 @@ export class DummyStore extends AbstractStore {
31
31
  return new this(options);
32
32
  }
33
33
  seed(options) {
34
- var _a;
35
34
  return __awaiter(this, void 0, void 0, function* () {
35
+ var _a;
36
36
  DummyStore.wasSeedInvoked = true;
37
37
  DummyStore.seedOptions = options;
38
38
  yield ((_a = DummyStore.seedCb) === null || _a === void 0 ? void 0 : _a.call(DummyStore));
@@ -41,8 +41,8 @@ let AuthenticatingAsAPersonTest = class AuthenticatingAsAPersonTest extends Abst
41
41
  });
42
42
  }
43
43
  static authReturnsProperType() {
44
- var _a;
45
44
  return __awaiter(this, void 0, void 0, function* () {
45
+ var _a;
46
46
  const client = yield this.connectAnon();
47
47
  const [{ type }] = yield client.emitAndFlattenResponses('authenticate::v2020_12_25', {
48
48
  payload: {
@@ -225,8 +225,8 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
225
225
  });
226
226
  }
227
227
  static canSyncTeammates(target, total) {
228
- var _a, _b;
229
228
  return __awaiter(this, void 0, void 0, function* () {
229
+ var _a, _b;
230
230
  yield this.fakeLoginAndRecords('locations', 1);
231
231
  yield this.fakeRecords(target, total);
232
232
  const fakedProp =
@@ -54,8 +54,8 @@ export default class SpyingMapUtilTest extends AbstractSpruceFixtureTest {
54
54
  });
55
55
  }
56
56
  static redirectingIsTracked() {
57
- var _a;
58
57
  return __awaiter(this, void 0, void 0, function* () {
58
+ var _a;
59
59
  const address = {
60
60
  city: generateId(),
61
61
  country: generateId(),
@@ -143,8 +143,8 @@ let SeedingDataTest = class SeedingDataTest extends AbstractSpruceFixtureTest {
143
143
  });
144
144
  }
145
145
  static returnsSeededGuests(options, expectedCount, base) {
146
- var _a;
147
146
  return __awaiter(this, void 0, void 0, function* () {
147
+ var _a;
148
148
  const _b = yield this.seedLocations(Object.assign({ totalLocations: 1, startingPhone: DEMO_NUMBER_SEED_FIXTURE_STARTING_PHONE }, options)), { locations } = _b, rest = __rest(_b, ["locations"]);
149
149
  const withoutOwner = yield this.listPeople(locations[0], base);
150
150
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -93,8 +93,8 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
93
93
  });
94
94
  }
95
95
  static scopeCanGetAndSetOrganization() {
96
- var _a;
97
96
  return __awaiter(this, void 0, void 0, function* () {
97
+ var _a;
98
98
  const { vc, fixture } = this.Scope();
99
99
  yield fixture.loginAsDemoPerson(DEMO_NUMBER_VIEW_FIXTURE);
100
100
  yield fixture.load(vc);
@@ -164,8 +164,8 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
164
164
  });
165
165
  }
166
166
  static scopeCanGetAndSetLocation() {
167
- var _a;
168
167
  return __awaiter(this, void 0, void 0, function* () {
168
+ var _a;
169
169
  yield this.fixture.loginAsDemoPerson(DEMO_NUMBER_VIEW_FIXTURE);
170
170
  const { vc, fixture } = this.Scope();
171
171
  yield fixture.load(vc);
@@ -203,8 +203,8 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
203
203
  });
204
204
  }
205
205
  static canSetScopeForCurrentOrganizationAcrossViewFixtures() {
206
- var _a;
207
206
  return __awaiter(this, void 0, void 0, function* () {
207
+ var _a;
208
208
  const org = yield this.organizations.seedDemoOrganization({
209
209
  phone: DEMO_NUMBER_VIEW_FIXTURE,
210
210
  name: 'My new org!',
@@ -217,8 +217,8 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
217
217
  });
218
218
  }
219
219
  static scopeShouldBeResetEachRun() {
220
- var _a;
221
220
  return __awaiter(this, void 0, void 0, function* () {
221
+ var _a;
222
222
  const { vc, fixture } = this.Scope();
223
223
  yield fixture.loginAsDemoPerson(DEMO_NUMBER_VIEW_FIXTURE);
224
224
  yield fixture.load(vc);
@@ -12,8 +12,8 @@ import AbstractSpruceFixtureTest from '../../tests/AbstractSpruceFixtureTest.js'
12
12
  import { DEMO_NUMBER } from '../../tests/constants.js';
13
13
  import fake from '../../tests/decorators/fake.js';
14
14
  export default class AbstractFakeDecoratorTest extends AbstractSpruceFixtureTest {
15
- static fakeLoginAndGetAuth(phone = DEMO_NUMBER) {
16
- return __awaiter(this, void 0, void 0, function* () {
15
+ static fakeLoginAndGetAuth() {
16
+ return __awaiter(this, arguments, void 0, function* (phone = DEMO_NUMBER) {
17
17
  yield this.fakeLogin(phone);
18
18
  const { client, person } = yield this.people.loginAsDemoPerson();
19
19
  const [{ auth, type }] = yield client.emitAndFlattenResponses('whoami::v2020_12_25');
@@ -23,8 +23,8 @@ export default class AbstractFakeDecoratorTest extends AbstractSpruceFixtureTest
23
23
  return auth;
24
24
  });
25
25
  }
26
- static fakeLogin(number = DEMO_NUMBER) {
27
- return __awaiter(this, void 0, void 0, function* () {
26
+ static fakeLogin() {
27
+ return __awaiter(this, arguments, void 0, function* (number = DEMO_NUMBER) {
28
28
  const decorator = fake.login(number);
29
29
  decorator(this, false);
30
30
  yield this.beforeAll();
@@ -67,8 +67,8 @@ login.on = (name, cb) => __awaiter(void 0, void 0, void 0, function* () {
67
67
  login.listeners[name] = cb;
68
68
  });
69
69
  function emitDidLogin(client) {
70
- var _a;
71
70
  return __awaiter(this, void 0, void 0, function* () {
71
+ var _a;
72
72
  //@ts-ignore
73
73
  let didLogin = (_a = login === null || login === void 0 ? void 0 : login.listeners) === null || _a === void 0 ? void 0 : _a['did-login'];
74
74
  if (didLogin) {
@@ -77,8 +77,8 @@ function emitDidLogin(client) {
77
77
  });
78
78
  }
79
79
  function emitWillLogout(client) {
80
- var _a;
81
80
  return __awaiter(this, void 0, void 0, function* () {
81
+ var _a;
82
82
  //@ts-ignore
83
83
  let willLogout = (_a = login === null || login === void 0 ? void 0 : login.listeners) === null || _a === void 0 ? void 0 : _a['will-logout'];
84
84
  if (willLogout) {
@@ -8,6 +8,6 @@ type Response<E extends Fqen> = ResponsePayloadSchema<E> extends Schema ? Schema
8
8
  declare const eventFaker: {
9
9
  makeEventThrow(fqen: Fqen, error?: any): Promise<void>;
10
10
  handleReactiveEvent(fqen: Fqen): Promise<void>;
11
- on<E extends Fqen>(fqen: E, cb: (targetAndPayload: SchemaValues<EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never, false, true, false, Extract<keyof (EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never)["fields"], string>, import("@sprucelabs/schema").SchemaPublicFieldNames<EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never>>) => Response<E> | Promise<Response<E>>): Promise<void>;
11
+ on<E extends Fqen>(fqen: E, cb: (targetAndPayload: TargetAndPayload<E>) => Response<E> | Promise<Response<E>>): Promise<void>;
12
12
  };
13
13
  export default eventFaker;
@@ -78,8 +78,8 @@ class LocationFixture {
78
78
  });
79
79
  }
80
80
  getNewestLocation(organizationId) {
81
- var _a;
82
81
  return __awaiter(this, void 0, void 0, function* () {
82
+ var _a;
83
83
  const { client } = yield this.people.loginAsDemoPerson();
84
84
  if (!organizationId) {
85
85
  const org = yield this.orgs.getNewestOrganization();
@@ -127,8 +127,8 @@ class MercuryFixture {
127
127
  this.originalHost = (_b = (_a = process.env.TEST_HOST) !== null && _a !== void 0 ? _a : process.env.HOST) !== null && _b !== void 0 ? _b : TEST_HOST;
128
128
  }
129
129
  static beforeEach(cwd) {
130
- var _a;
131
130
  return __awaiter(this, void 0, void 0, function* () {
131
+ var _a;
132
132
  if (this.originalHost) {
133
133
  process.env.HOST = this.originalHost;
134
134
  }
@@ -68,8 +68,8 @@ export default class OrganizationFixture {
68
68
  });
69
69
  }
70
70
  getNewestOrganization(phone) {
71
- var _a;
72
71
  return __awaiter(this, void 0, void 0, function* () {
72
+ var _a;
73
73
  const { client } = yield this.people.loginAsDemoPerson(phone);
74
74
  const [{ organizations }] = yield client.emitAndFlattenResponses('list-organizations::v2020_12_25', {
75
75
  payload: {
@@ -166,7 +166,7 @@ export default class OrganizationFixture {
166
166
  }
167
167
  destroy() {
168
168
  return __awaiter(this, void 0, void 0, function* () {
169
- yield Promise.all(this.organizations.map(({ organization, client }) => __awaiter(this, void 0, void 0, function* () {
169
+ yield Promise.all(this.organizations.map((_a) => __awaiter(this, [_a], void 0, function* ({ organization, client }) {
170
170
  yield client.emitAndFlattenResponses('delete-organization::v2020_12_25', {
171
171
  target: {
172
172
  organizationId: organization.id,
@@ -50,8 +50,8 @@ export default class PersonFixture {
50
50
  });
51
51
  }
52
52
  loginAsDemoPerson(phone) {
53
- var _a, _b, _c;
54
53
  return __awaiter(this, void 0, void 0, function* () {
54
+ var _a, _b, _c;
55
55
  if (this.lastLoggedIn &&
56
56
  (!phone || formatPhoneNumber(phone) === this.lastLoggedIn.person.phone)) {
57
57
  return this.lastLoggedIn;
@@ -28,36 +28,36 @@ export default class SeedFixture {
28
28
  });
29
29
  }
30
30
  seedGuests(options) {
31
- var _a;
32
31
  return __awaiter(this, void 0, void 0, function* () {
32
+ var _a;
33
33
  yield this.seedPeople(Object.assign(Object.assign({}, options), { startingPhone: (_a = SeedFixture.lastPhone) !== null && _a !== void 0 ? _a : '555-999-0000' }));
34
34
  return [];
35
35
  });
36
36
  }
37
37
  seedTeammates(options) {
38
- var _a;
39
38
  return __awaiter(this, void 0, void 0, function* () {
39
+ var _a;
40
40
  yield this.seedPeople(Object.assign(Object.assign({}, options), { startingPhone: (_a = SeedFixture.lastPhone) !== null && _a !== void 0 ? _a : '555-999-1000' }));
41
41
  return [];
42
42
  });
43
43
  }
44
44
  seedGroupManagers(options) {
45
- var _a;
46
45
  return __awaiter(this, void 0, void 0, function* () {
46
+ var _a;
47
47
  yield this.seedPeople(Object.assign(Object.assign({}, options), { startingPhone: (_a = SeedFixture.lastPhone) !== null && _a !== void 0 ? _a : '555-999-2000' }));
48
48
  return [];
49
49
  });
50
50
  }
51
51
  seedManagers(options) {
52
- var _a;
53
52
  return __awaiter(this, void 0, void 0, function* () {
53
+ var _a;
54
54
  yield this.seedPeople(Object.assign(Object.assign({}, options), { startingPhone: (_a = SeedFixture.lastPhone) !== null && _a !== void 0 ? _a : '555-999-3000' }));
55
55
  return [];
56
56
  });
57
57
  }
58
58
  seedOwners(options) {
59
- var _a;
60
59
  return __awaiter(this, void 0, void 0, function* () {
60
+ var _a;
61
61
  yield this.seedPeople(Object.assign(Object.assign({}, options), { startingPhone: (_a = SeedFixture.lastPhone) !== null && _a !== void 0 ? _a : '555-999-4000' }));
62
62
  return [];
63
63
  });
@@ -78,8 +78,8 @@ export default class SeedFixture {
78
78
  });
79
79
  }
80
80
  seedPeople(options) {
81
- var _a;
82
81
  return __awaiter(this, void 0, void 0, function* () {
82
+ var _a;
83
83
  let { totalGroupManagers, totalGuests, totalManagers, totalOwners, totalTeammates, startingPhone, locationId, organizationId, } = options;
84
84
  if (!organizationId) {
85
85
  const org = yield this.organizations.getNewestOrganization();
@@ -57,8 +57,8 @@ export default class SkillFixture {
57
57
  });
58
58
  }
59
59
  loginAsCurrentSkill() {
60
- var _a;
61
60
  return __awaiter(this, void 0, void 0, function* () {
61
+ var _a;
62
62
  const missing = [];
63
63
  if (!process.env.SKILL_ID) {
64
64
  missing.push('env.SKILL_ID');
@@ -98,7 +98,7 @@ export default class SkillFixture {
98
98
  }
99
99
  destroy() {
100
100
  return __awaiter(this, void 0, void 0, function* () {
101
- yield Promise.all(this.skills.map(({ skill, client }) => __awaiter(this, void 0, void 0, function* () {
101
+ yield Promise.all(this.skills.map((_a) => __awaiter(this, [_a], void 0, function* ({ skill, client }) {
102
102
  return client.emit('unregister-skill::v2020_12_25', {
103
103
  target: {
104
104
  skillId: skill.id,
@@ -184,8 +184,8 @@ class ViewFixture {
184
184
  ClientProxyDecorator.getInstance().clearProxyTokenGenerator();
185
185
  }
186
186
  load(vc, args) {
187
- var _a;
188
187
  return __awaiter(this, void 0, void 0, function* () {
188
+ var _a;
189
189
  yield this.assertScopeRequirementsMet(vc);
190
190
  const scope = (_a = vc === null || vc === void 0 ? void 0 : vc.getScope) === null || _a === void 0 ? void 0 : _a.call(vc);
191
191
  if (scope) {
@@ -198,8 +198,8 @@ class ViewFixture {
198
198
  return this.getRouter().getThemes();
199
199
  }
200
200
  assertScopeRequirementsMet(vc) {
201
- var _a, _b;
202
201
  return __awaiter(this, void 0, void 0, function* () {
202
+ var _a, _b;
203
203
  if (doesScopeIncludeOrganization((_a = vc.getScope) === null || _a === void 0 ? void 0 : _a.call(vc))) {
204
204
  const org = yield this.getScope().getCurrentOrganization();
205
205
  if (!org) {
@@ -70,8 +70,8 @@ class TestRouter extends AbstractEventEmitter {
70
70
  return this.presentVc;
71
71
  }
72
72
  redirect(id, args) {
73
- var _a, _b;
74
73
  return __awaiter(this, void 0, void 0, function* () {
74
+ var _a, _b;
75
75
  if (TestRouter.shouldThrowWhenRedirectingToBadSvc ||
76
76
  this.vcFactory.hasController(id)) {
77
77
  //@ts-ignore
@@ -8,6 +8,6 @@ type Response<E extends Fqen> = ResponsePayloadSchema<E> extends Schema ? Schema
8
8
  declare const eventFaker: {
9
9
  makeEventThrow(fqen: Fqen, error?: any): Promise<void>;
10
10
  handleReactiveEvent(fqen: Fqen): Promise<void>;
11
- on<E extends Fqen>(fqen: E, cb: (targetAndPayload: SchemaValues<EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never, false, true, false, Extract<keyof (EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never)["fields"], string>, import("@sprucelabs/schema").SchemaPublicFieldNames<EmitPayloadSchema<E> extends Schema ? EmitPayloadSchema<E> : never>>) => Response<E> | Promise<Response<E>>): Promise<void>;
11
+ on<E extends Fqen>(fqen: E, cb: (targetAndPayload: TargetAndPayload<E>) => Response<E> | Promise<Response<E>>): Promise<void>;
12
12
  };
13
13
  export default eventFaker;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "60.1.271",
16
+ "version": "60.1.272",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -62,30 +62,30 @@
62
62
  "lint.tsc": "tsc -p . --noEmit"
63
63
  },
64
64
  "dependencies": {
65
- "@sprucelabs/data-stores": "^26.4.36",
66
- "@sprucelabs/error": "^5.1.65",
67
- "@sprucelabs/heartwood-view-controllers": "^108.40.132",
68
- "@sprucelabs/mercury-client": "^41.0.316",
69
- "@sprucelabs/mercury-core-events": "^22.2.20",
70
- "@sprucelabs/mercury-event-emitter": "^41.0.316",
71
- "@sprucelabs/schema": "^29.4.10",
72
- "@sprucelabs/spruce-core-schemas": "^39.0.241",
73
- "@sprucelabs/spruce-event-utils": "^38.0.287",
74
- "@sprucelabs/spruce-permission-utils": "^7.0.494",
75
- "@sprucelabs/spruce-skill-booter": "^60.1.271",
76
- "@sprucelabs/spruce-skill-utils": "^30.3.1",
77
- "@sprucelabs/test-utils": "^4.0.108",
65
+ "@sprucelabs/data-stores": "^26.4.38",
66
+ "@sprucelabs/error": "^5.1.66",
67
+ "@sprucelabs/heartwood-view-controllers": "^108.40.135",
68
+ "@sprucelabs/mercury-client": "^41.0.319",
69
+ "@sprucelabs/mercury-core-events": "^22.2.23",
70
+ "@sprucelabs/mercury-event-emitter": "^41.0.319",
71
+ "@sprucelabs/schema": "^29.4.12",
72
+ "@sprucelabs/spruce-core-schemas": "^39.0.244",
73
+ "@sprucelabs/spruce-event-utils": "^38.0.289",
74
+ "@sprucelabs/spruce-permission-utils": "^7.0.497",
75
+ "@sprucelabs/spruce-skill-booter": "^60.1.272",
76
+ "@sprucelabs/spruce-skill-utils": "^30.3.3",
77
+ "@sprucelabs/test-utils": "^4.0.110",
78
78
  "dotenv": "^16.4.5",
79
79
  "unique-names-generator": "^4.7.1"
80
80
  },
81
81
  "devDependencies": {
82
- "@sprucelabs/esm-postbuild": "^5.0.161",
83
- "@sprucelabs/jest-json-reporter": "^7.0.173",
82
+ "@sprucelabs/esm-postbuild": "^5.0.163",
83
+ "@sprucelabs/jest-json-reporter": "^7.0.175",
84
84
  "@sprucelabs/jest-sheets-reporter": "^3.0.26",
85
- "@sprucelabs/mercury-types": "^46.0.243",
86
- "@sprucelabs/resolve-path-aliases": "^1.1.283",
85
+ "@sprucelabs/mercury-types": "^46.0.246",
86
+ "@sprucelabs/resolve-path-aliases": "^1.1.284",
87
87
  "@sprucelabs/semantic-release": "^4.0.8",
88
- "@sprucelabs/test": "^8.0.41",
88
+ "@sprucelabs/test": "^8.0.42",
89
89
  "@types/node": "17.0.5",
90
90
  "calendar-utils": "^0.10.4",
91
91
  "chokidar-cli": "^3.0.0",
@@ -98,7 +98,7 @@
98
98
  "ts-node": "^10.9.2",
99
99
  "tsc-watch": "^6.0.4",
100
100
  "tsconfig-paths": "^4.2.0",
101
- "typescript": "^5.3.3"
101
+ "typescript": "^5.4.2"
102
102
  },
103
103
  "jest": {
104
104
  "maxWorkers": 2,
@@ -132,5 +132,5 @@
132
132
  ]
133
133
  ]
134
134
  },
135
- "gitHead": "a04260369f3799d7ce939a83b2a6e415cbe9e912"
135
+ "gitHead": "03ea050d976fb41307cecc4581fd9aca968fd40f"
136
136
  }