@sprucelabs/spruce-test-fixtures 49.0.14 → 49.0.17

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.
@@ -4,6 +4,8 @@ export default class LocationFixtureTest extends AbstractSpruceFixtureTest {
4
4
  protected static canCreateWithSpecificOrg(): Promise<void>;
5
5
  protected static canCreatLocationWithNoParams(): Promise<void>;
6
6
  protected static isNotPartOfLocationToStart(): Promise<void>;
7
+ protected static uniqueLocationName(): Promise<void>;
8
+ protected static locationCountResetBeforeEach(): Promise<void>;
7
9
  protected static canAddPersonToLocation(): Promise<void>;
8
10
  protected static throwsWhenTryingToRemovePersonWithBadIds(): Promise<void>;
9
11
  protected static canRemoveRole(): Promise<void>;
@@ -14,6 +14,7 @@ const test_1 = require("@sprucelabs/test");
14
14
  const AbstractSpruceFixtureTest_1 = __importDefault(require("../../tests/AbstractSpruceFixtureTest"));
15
15
  const constants_1 = require("../../tests/constants");
16
16
  const fake_1 = __importDefault(require("../../tests/decorators/fake"));
17
+ const LocationFixture_1 = __importDefault(require("../../tests/fixtures/LocationFixture"));
17
18
  let LocationFixtureTest = LocationFixtureTest_1 = class LocationFixtureTest extends AbstractSpruceFixtureTest_1.default {
18
19
  static async beforeEach() {
19
20
  await super.beforeEach();
@@ -46,6 +47,15 @@ let LocationFixtureTest = LocationFixtureTest_1 = class LocationFixtureTest exte
46
47
  });
47
48
  test_1.assert.isFalse(isHired);
48
49
  }
50
+ static async uniqueLocationName() {
51
+ const location1 = await this.locations.seedDemoLocation({});
52
+ const location2 = await this.locations.seedDemoLocation({});
53
+ test_1.assert.isNotEqual(location1.name, location2.name);
54
+ }
55
+ static async locationCountResetBeforeEach() {
56
+ //@ts-ignore
57
+ test_1.assert.isEqual(LocationFixture_1.default.locationCount, 0);
58
+ }
49
59
  static async canAddPersonToLocation() {
50
60
  const { person, location } = await this.seedLocationAndAddPerson();
51
61
  const isHired = await LocationFixtureTest_1.isPersonPartOfLocation(person.id, location.id);
@@ -113,6 +123,12 @@ __decorate([
113
123
  __decorate([
114
124
  (0, test_1.test)()
115
125
  ], LocationFixtureTest, "isNotPartOfLocationToStart", null);
126
+ __decorate([
127
+ (0, test_1.test)()
128
+ ], LocationFixtureTest, "uniqueLocationName", null);
129
+ __decorate([
130
+ (0, test_1.test)()
131
+ ], LocationFixtureTest, "locationCountResetBeforeEach", null);
116
132
  __decorate([
117
133
  (0, test_1.test)()
118
134
  ], LocationFixtureTest, "canAddPersonToLocation", null);
@@ -4,6 +4,8 @@ export default class LocationFixtureTest extends AbstractSpruceFixtureTest {
4
4
  protected static canCreateWithSpecificOrg(): Promise<void>;
5
5
  protected static canCreatLocationWithNoParams(): Promise<void>;
6
6
  protected static isNotPartOfLocationToStart(): Promise<void>;
7
+ protected static uniqueLocationName(): Promise<void>;
8
+ protected static locationCountResetBeforeEach(): Promise<void>;
7
9
  protected static canAddPersonToLocation(): Promise<void>;
8
10
  protected static throwsWhenTryingToRemovePersonWithBadIds(): Promise<void>;
9
11
  protected static canRemoveRole(): Promise<void>;
@@ -18,6 +18,7 @@ import { test, assert } from '@sprucelabs/test';
18
18
  import AbstractSpruceFixtureTest from '../../tests/AbstractSpruceFixtureTest.js';
19
19
  import { DEMO_NUMBER_LOCATION_FIXTURE, DEMO_NUMBER_LOCATION_FIXTURE_OUTSIDER, } from '../../tests/constants.js';
20
20
  import fake from '../../tests/decorators/fake.js';
21
+ import LocationFixture from '../../tests/fixtures/LocationFixture.js';
21
22
  let LocationFixtureTest = LocationFixtureTest_1 = class LocationFixtureTest extends AbstractSpruceFixtureTest {
22
23
  static beforeEach() {
23
24
  const _super = Object.create(null, {
@@ -61,6 +62,19 @@ let LocationFixtureTest = LocationFixtureTest_1 = class LocationFixtureTest exte
61
62
  assert.isFalse(isHired);
62
63
  });
63
64
  }
65
+ static uniqueLocationName() {
66
+ return __awaiter(this, void 0, void 0, function* () {
67
+ const location1 = yield this.locations.seedDemoLocation({});
68
+ const location2 = yield this.locations.seedDemoLocation({});
69
+ assert.isNotEqual(location1.name, location2.name);
70
+ });
71
+ }
72
+ static locationCountResetBeforeEach() {
73
+ return __awaiter(this, void 0, void 0, function* () {
74
+ //@ts-ignore
75
+ assert.isEqual(LocationFixture.locationCount, 0);
76
+ });
77
+ }
64
78
  static canAddPersonToLocation() {
65
79
  return __awaiter(this, void 0, void 0, function* () {
66
80
  const { person, location } = yield this.seedLocationAndAddPerson();
@@ -138,6 +152,12 @@ __decorate([
138
152
  __decorate([
139
153
  test()
140
154
  ], LocationFixtureTest, "isNotPartOfLocationToStart", null);
155
+ __decorate([
156
+ test()
157
+ ], LocationFixtureTest, "uniqueLocationName", null);
158
+ __decorate([
159
+ test()
160
+ ], LocationFixtureTest, "locationCountResetBeforeEach", null);
141
161
  __decorate([
142
162
  test()
143
163
  ], LocationFixtureTest, "canAddPersonToLocation", null);
@@ -176,6 +176,7 @@ export default class FixtureFactory {
176
176
  StoreFixture.beforeEach(),
177
177
  EventFixture.beforeEach(),
178
178
  SchemaFixture.beforeEach(),
179
+ LocationFixture.beforeEach(),
179
180
  ]);
180
181
  });
181
182
  }
@@ -7,6 +7,7 @@ export default class LocationFixture {
7
7
  private orgs;
8
8
  private roles;
9
9
  private locationCounter;
10
+ private static locationCount;
10
11
  constructor(options: {
11
12
  people: PersonFixture;
12
13
  organizations: OrganizationFixture;
@@ -25,6 +26,7 @@ export default class LocationFixture {
25
26
  locationId: string;
26
27
  phone?: string;
27
28
  }): Promise<boolean>;
29
+ static beforeEach(): void;
28
30
  addPerson(options: {
29
31
  personId: string;
30
32
  locationId: string;
@@ -20,6 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  };
21
21
  import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
22
22
  import { assert } from '@sprucelabs/test';
23
+ import { generateId } from '@sprucelabs/test-utils';
23
24
  export default class LocationFixture {
24
25
  constructor(options) {
25
26
  this.locationCounter = 0;
@@ -48,7 +49,7 @@ export default class LocationFixture {
48
49
  target: {
49
50
  organizationId: orgId,
50
51
  },
51
- payload: Object.assign({ name: 'Location from fixture', slug: this.generateLocationSlug(), isPublic: true, address: {
52
+ payload: Object.assign({ name: `Location ${LocationFixture.locationCount++} - ${generateId()}`, slug: this.generateLocationSlug(), isPublic: true, address: {
52
53
  street1: '123 Main St',
53
54
  city: 'Denver',
54
55
  province: 'CO',
@@ -124,6 +125,9 @@ export default class LocationFixture {
124
125
  return roles.length > 0;
125
126
  });
126
127
  }
128
+ static beforeEach() {
129
+ this.locationCount = 0;
130
+ }
127
131
  addPerson(options) {
128
132
  return __awaiter(this, void 0, void 0, function* () {
129
133
  yield this.roles.addRoleToPerson(options);
@@ -135,3 +139,4 @@ export default class LocationFixture {
135
139
  });
136
140
  }
137
141
  }
142
+ LocationFixture.locationCount = 0;
@@ -167,6 +167,7 @@ class FixtureFactory {
167
167
  StoreFixture_1.default.beforeEach(),
168
168
  EventFixture_1.default.beforeEach(),
169
169
  SchemaFixture_1.default.beforeEach(),
170
+ LocationFixture_1.default.beforeEach(),
170
171
  ]);
171
172
  }
172
173
  static async afterEach() {
@@ -7,6 +7,7 @@ export default class LocationFixture {
7
7
  private orgs;
8
8
  private roles;
9
9
  private locationCounter;
10
+ private static locationCount;
10
11
  constructor(options: {
11
12
  people: PersonFixture;
12
13
  organizations: OrganizationFixture;
@@ -25,6 +26,7 @@ export default class LocationFixture {
25
26
  locationId: string;
26
27
  phone?: string;
27
28
  }): Promise<boolean>;
29
+ static beforeEach(): void;
28
30
  addPerson(options: {
29
31
  personId: string;
30
32
  locationId: string;
@@ -13,6 +13,7 @@ var __rest = (this && this.__rest) || function (s, e) {
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
15
15
  const test_1 = require("@sprucelabs/test");
16
+ const test_utils_1 = require("@sprucelabs/test-utils");
16
17
  class LocationFixture {
17
18
  constructor(options) {
18
19
  this.locationCounter = 0;
@@ -40,7 +41,7 @@ class LocationFixture {
40
41
  target: {
41
42
  organizationId: orgId,
42
43
  },
43
- payload: Object.assign({ name: 'Location from fixture', slug: this.generateLocationSlug(), isPublic: true, address: {
44
+ payload: Object.assign({ name: `Location ${LocationFixture.locationCount++} - ${(0, test_utils_1.generateId)()}`, slug: this.generateLocationSlug(), isPublic: true, address: {
44
45
  street1: '123 Main St',
45
46
  city: 'Denver',
46
47
  province: 'CO',
@@ -107,6 +108,9 @@ class LocationFixture {
107
108
  const roles = await this.roles.listRoles(options);
108
109
  return roles.length > 0;
109
110
  }
111
+ static beforeEach() {
112
+ this.locationCount = 0;
113
+ }
110
114
  async addPerson(options) {
111
115
  await this.roles.addRoleToPerson(options);
112
116
  }
@@ -115,3 +119,4 @@ class LocationFixture {
115
119
  }
116
120
  }
117
121
  exports.default = LocationFixture;
122
+ LocationFixture.locationCount = 0;
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "49.0.14",
16
+ "version": "49.0.17",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -62,33 +62,33 @@
62
62
  "lint.tsc": "tsc -p . --noEmit"
63
63
  },
64
64
  "dependencies": {
65
- "@sprucelabs/data-stores": "^18.1.33",
66
- "@sprucelabs/error": "^5.0.504",
67
- "@sprucelabs/heartwood-view-controllers": "^90.2.0",
68
- "@sprucelabs/mercury-client": "^31.0.183",
69
- "@sprucelabs/mercury-core-events": "^12.0.184",
70
- "@sprucelabs/mercury-event-emitter": "^31.0.183",
71
- "@sprucelabs/schema": "^28.4.35",
72
- "@sprucelabs/spruce-core-schemas": "^34.2.85",
73
- "@sprucelabs/spruce-event-utils": "^27.0.158",
74
- "@sprucelabs/spruce-skill-booter": "^49.0.14",
75
- "@sprucelabs/spruce-skill-utils": "^26.4.61",
65
+ "@sprucelabs/data-stores": "^18.1.34",
66
+ "@sprucelabs/error": "^5.0.505",
67
+ "@sprucelabs/heartwood-view-controllers": "^90.3.1",
68
+ "@sprucelabs/mercury-client": "^31.0.184",
69
+ "@sprucelabs/mercury-core-events": "^12.0.185",
70
+ "@sprucelabs/mercury-event-emitter": "^31.0.184",
71
+ "@sprucelabs/schema": "^28.4.36",
72
+ "@sprucelabs/spruce-core-schemas": "^34.2.86",
73
+ "@sprucelabs/spruce-event-utils": "^27.0.159",
74
+ "@sprucelabs/spruce-skill-booter": "^49.0.17",
75
+ "@sprucelabs/spruce-skill-utils": "^26.4.62",
76
76
  "dotenv": "^16.0.2",
77
77
  "unique-names-generator": "^4.7.1"
78
78
  },
79
79
  "devDependencies": {
80
- "@sprucelabs/esm-postbuild": "^1.0.571",
81
- "@sprucelabs/jest-json-reporter": "^6.0.463",
82
- "@sprucelabs/jest-sheets-reporter": "^1.3.94",
83
- "@sprucelabs/mercury-types": "^35.0.127",
84
- "@sprucelabs/resolve-path-aliases": "^1.1.92",
80
+ "@sprucelabs/esm-postbuild": "^1.0.572",
81
+ "@sprucelabs/jest-json-reporter": "^6.0.464",
82
+ "@sprucelabs/jest-sheets-reporter": "^1.3.95",
83
+ "@sprucelabs/mercury-types": "^35.0.128",
84
+ "@sprucelabs/resolve-path-aliases": "^1.1.93",
85
85
  "@sprucelabs/semantic-release": "^4.0.8",
86
86
  "@sprucelabs/test": "^7.7.354",
87
- "@sprucelabs/test-utils": "^3.1.74",
87
+ "@sprucelabs/test-utils": "^3.1.75",
88
88
  "@types/node": "17.0.5",
89
89
  "calendar-utils": "^0.10.1",
90
90
  "chokidar-cli": "^3.0.0",
91
- "concurrently": "^7.3.0",
91
+ "concurrently": "^7.4.0",
92
92
  "eslint": "^8.23.0",
93
93
  "eslint-config-spruce": "^10.11.4",
94
94
  "jest": "^29.0.2",
@@ -131,5 +131,5 @@
131
131
  ]
132
132
  ]
133
133
  },
134
- "gitHead": "c297dc37df782282e8b5f9ac56c449770d130ce1"
134
+ "gitHead": "dd48152a9c85e250f5f327926f09c40621a1bd77"
135
135
  }