@sprucelabs/spruce-test-fixtures 62.2.330 → 62.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -198,6 +198,7 @@ function setupFakeListeners(Class) {
198
198
  fakeUpdatePerson(Class),
199
199
  fakeListLocations(Class),
200
200
  fakeGetLocation(Class),
201
+ fakeUpdateLocation(Class),
201
202
  fakeDeleteOrganization(Class),
202
203
  fakeCreateLocation(Class),
203
204
  fakeCreateOrganization(Class),
@@ -397,6 +398,24 @@ function fakeGetLocation(Class) {
397
398
  });
398
399
  });
399
400
  }
401
+ function fakeUpdateLocation(Class) {
402
+ return __awaiter(this, void 0, void 0, function* () {
403
+ yield eventFaker.on('update-location::v2020_12_25', ({ target, payload }) => {
404
+ const { locationId } = target;
405
+ let idx = Class._fakedLocations.findIndex((l) => l.id === locationId);
406
+ if (!Class._fakedLocations[idx]) {
407
+ throw new SpruceError({
408
+ code: 'INVALID_TARGET',
409
+ friendlyMessage: `I could not find that location to update!`,
410
+ });
411
+ }
412
+ Class._fakedLocations[idx] = Object.assign(Object.assign({}, Class._fakedLocations[idx]), payload);
413
+ return {
414
+ location: Class._fakedLocations[idx],
415
+ };
416
+ });
417
+ });
418
+ }
400
419
  function fakeDeleteOrganization(Class) {
401
420
  return __awaiter(this, void 0, void 0, function* () {
402
421
  yield eventFaker.on('delete-organization::v2020_12_25', ({ target: { organizationId } }) => {
@@ -13,10 +13,7 @@ export default class LocationFixture {
13
13
  organizations: OrganizationFixture;
14
14
  roles: RoleFixture;
15
15
  });
16
- seedDemoLocation(values?: Partial<SpruceSchemas.Mercury.v2020_12_25.CreateLocationEmitPayload> & {
17
- phone?: string | null;
18
- organizationId?: string | null;
19
- }): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
16
+ seedDemoLocation(values?: SeedLocationValues): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
20
17
  private generateLocationSlug;
21
18
  getLocationById(id: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
22
19
  getNewestLocation(organizationId?: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num"> | null>;
@@ -42,3 +39,7 @@ export default class LocationFixture {
42
39
  roleBase: string;
43
40
  }): Promise<void>;
44
41
  }
42
+ export type SeedLocationValues = Partial<SpruceSchemas.Mercury.v2020_12_25.CreateLocationEmitPayload> & {
43
+ phone?: string | null;
44
+ organizationId?: string | null;
45
+ };
@@ -1,4 +1,3 @@
1
- import { AddressFieldValue } from '@sprucelabs/schema';
2
1
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
2
  import { RoleBase } from '../../types/fixture.types';
4
3
  import PersonFixture from './PersonFixture';
@@ -17,11 +16,8 @@ export default class OrganizationFixture {
17
16
  slug?: string;
18
17
  }): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug">>;
19
18
  getOrganizationById(id: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug">>;
20
- updateOrganization(id: string, values: {
21
- name?: string;
19
+ updateOrganization(id: string, values: SpruceSchemas.Mercury.v2020_12_25.UpdateOrgEmitPayload & {
22
20
  phone?: string;
23
- address?: AddressFieldValue;
24
- isPublic?: boolean;
25
21
  }): Promise<void>;
26
22
  getNewestOrganization(phone?: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug"> | null>;
27
23
  private generateOrgSlug;
@@ -193,6 +193,7 @@ async function setupFakeListeners(Class) {
193
193
  fakeUpdatePerson(Class),
194
194
  fakeListLocations(Class),
195
195
  fakeGetLocation(Class),
196
+ fakeUpdateLocation(Class),
196
197
  fakeDeleteOrganization(Class),
197
198
  fakeCreateLocation(Class),
198
199
  fakeCreateOrganization(Class),
@@ -375,6 +376,22 @@ async function fakeGetLocation(Class) {
375
376
  };
376
377
  });
377
378
  }
379
+ async function fakeUpdateLocation(Class) {
380
+ await eventFaker_1.default.on('update-location::v2020_12_25', ({ target, payload }) => {
381
+ const { locationId } = target;
382
+ let idx = Class._fakedLocations.findIndex((l) => l.id === locationId);
383
+ if (!Class._fakedLocations[idx]) {
384
+ throw new SpruceError_1.default({
385
+ code: 'INVALID_TARGET',
386
+ friendlyMessage: `I could not find that location to update!`,
387
+ });
388
+ }
389
+ Class._fakedLocations[idx] = Object.assign(Object.assign({}, Class._fakedLocations[idx]), payload);
390
+ return {
391
+ location: Class._fakedLocations[idx],
392
+ };
393
+ });
394
+ }
378
395
  async function fakeDeleteOrganization(Class) {
379
396
  await eventFaker_1.default.on('delete-organization::v2020_12_25', ({ target: { organizationId } }) => {
380
397
  const idx = Class._fakedOrganizations.findIndex((o) => o.id === organizationId);
@@ -13,10 +13,7 @@ export default class LocationFixture {
13
13
  organizations: OrganizationFixture;
14
14
  roles: RoleFixture;
15
15
  });
16
- seedDemoLocation(values?: Partial<SpruceSchemas.Mercury.v2020_12_25.CreateLocationEmitPayload> & {
17
- phone?: string | null;
18
- organizationId?: string | null;
19
- }): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
16
+ seedDemoLocation(values?: SeedLocationValues): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
20
17
  private generateLocationSlug;
21
18
  getLocationById(id: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num">>;
22
19
  getNewestLocation(organizationId?: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.LocationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.LocationSchema, false>>, "id" | "address" | "phone" | "name" | "organizationId" | "timezone" | "dateCreated" | "dateDeleted" | "isPublic" | "slug" | "num"> | null>;
@@ -42,3 +39,7 @@ export default class LocationFixture {
42
39
  roleBase: string;
43
40
  }): Promise<void>;
44
41
  }
42
+ export type SeedLocationValues = Partial<SpruceSchemas.Mercury.v2020_12_25.CreateLocationEmitPayload> & {
43
+ phone?: string | null;
44
+ organizationId?: string | null;
45
+ };
@@ -1,4 +1,3 @@
1
- import { AddressFieldValue } from '@sprucelabs/schema';
2
1
  import { SpruceSchemas } from '@sprucelabs/spruce-core-schemas';
3
2
  import { RoleBase } from '../../types/fixture.types';
4
3
  import PersonFixture from './PersonFixture';
@@ -17,11 +16,8 @@ export default class OrganizationFixture {
17
16
  slug?: string;
18
17
  }): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug">>;
19
18
  getOrganizationById(id: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug">>;
20
- updateOrganization(id: string, values: {
21
- name?: string;
19
+ updateOrganization(id: string, values: SpruceSchemas.Mercury.v2020_12_25.UpdateOrgEmitPayload & {
22
20
  phone?: string;
23
- address?: AddressFieldValue;
24
- isPublic?: boolean;
25
21
  }): Promise<void>;
26
22
  getNewestOrganization(phone?: string): Promise<Pick<import("@sprucelabs/schema").SchemaStaticValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false, import("@sprucelabs/schema").SchemaOptionalFieldNames<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema>, import("@sprucelabs/schema").StaticSchemaAllValues<SpruceSchemas.Spruce.v2020_07_22.OrganizationSchema, false>>, "id" | "address" | "name" | "dateCreated" | "dateDeleted" | "isPublic" | "slug"> | null>;
27
23
  private generateOrgSlug;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "62.2.330",
16
+ "version": "62.3.0",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -61,27 +61,27 @@
61
61
  "lint.tsc": "tsc -p . --noEmit"
62
62
  },
63
63
  "dependencies": {
64
- "@sprucelabs/data-stores": "^28.3.81",
65
- "@sprucelabs/error": "^6.0.424",
66
- "@sprucelabs/heartwood-view-controllers": "^110.12.136",
67
- "@sprucelabs/mercury-client": "^42.0.476",
68
- "@sprucelabs/mercury-core-events": "^24.3.234",
69
- "@sprucelabs/mercury-event-emitter": "^42.0.476",
70
- "@sprucelabs/schema": "^30.0.473",
71
- "@sprucelabs/spruce-core-schemas": "^40.1.417",
72
- "@sprucelabs/spruce-event-utils": "^40.1.195",
73
- "@sprucelabs/spruce-permission-utils": "^8.0.551",
74
- "@sprucelabs/spruce-skill-booter": "^62.2.330",
75
- "@sprucelabs/spruce-skill-utils": "^31.0.492",
76
- "@sprucelabs/test-utils": "^5.1.371",
64
+ "@sprucelabs/data-stores": "^28.3.82",
65
+ "@sprucelabs/error": "^6.0.425",
66
+ "@sprucelabs/heartwood-view-controllers": "^110.12.137",
67
+ "@sprucelabs/mercury-client": "^42.0.477",
68
+ "@sprucelabs/mercury-core-events": "^24.3.235",
69
+ "@sprucelabs/mercury-event-emitter": "^42.0.477",
70
+ "@sprucelabs/schema": "^30.0.474",
71
+ "@sprucelabs/spruce-core-schemas": "^40.1.418",
72
+ "@sprucelabs/spruce-event-utils": "^40.1.196",
73
+ "@sprucelabs/spruce-permission-utils": "^8.0.552",
74
+ "@sprucelabs/spruce-skill-booter": "^62.3.0",
75
+ "@sprucelabs/spruce-skill-utils": "^31.0.493",
76
+ "@sprucelabs/test-utils": "^5.1.372",
77
77
  "dotenv": "^16.4.5",
78
78
  "unique-names-generator": "^4.7.1"
79
79
  },
80
80
  "devDependencies": {
81
- "@sprucelabs/esm-postbuild": "^6.0.408",
82
- "@sprucelabs/jest-json-reporter": "^8.0.424",
83
- "@sprucelabs/mercury-types": "^47.0.474",
84
- "@sprucelabs/resolve-path-aliases": "^2.0.403",
81
+ "@sprucelabs/esm-postbuild": "^6.0.409",
82
+ "@sprucelabs/jest-json-reporter": "^8.0.425",
83
+ "@sprucelabs/mercury-types": "^47.0.475",
84
+ "@sprucelabs/resolve-path-aliases": "^2.0.404",
85
85
  "@sprucelabs/semantic-release": "^5.0.2",
86
86
  "@sprucelabs/test": "^9.0.47",
87
87
  "@types/node": "17.0.5",
@@ -114,5 +114,5 @@
114
114
  "^#spruce/(.*)$": "<rootDir>/build/.spruce/$1"
115
115
  }
116
116
  },
117
- "gitHead": "89c8bde0bb9e4d58a335d5c8a1b7ef266da13564"
117
+ "gitHead": "dd46386089c9e94482ed9e51dd7f18dc2fe72baa"
118
118
  }