@sprucelabs/spruce-test-fixtures 49.0.13 → 49.0.16
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/__tests__/behavioral/LocationFixture.test.d.ts +2 -0
- package/build/__tests__/behavioral/LocationFixture.test.js +16 -0
- package/build/esm/__tests__/behavioral/LocationFixture.test.d.ts +2 -0
- package/build/esm/__tests__/behavioral/LocationFixture.test.js +20 -0
- package/build/esm/tests/fixtures/FixtureFactory.js +1 -0
- package/build/esm/tests/fixtures/LocationFixture.d.ts +2 -0
- package/build/esm/tests/fixtures/LocationFixture.js +6 -1
- package/build/tests/fixtures/FixtureFactory.js +1 -0
- package/build/tests/fixtures/LocationFixture.d.ts +2 -0
- package/build/tests/fixtures/LocationFixture.js +6 -1
- package/package.json +4 -4
|
@@ -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);
|
|
@@ -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:
|
|
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;
|
|
@@ -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:
|
|
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.
|
|
16
|
+
"version": "49.0.16",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -64,14 +64,14 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@sprucelabs/data-stores": "^18.1.33",
|
|
66
66
|
"@sprucelabs/error": "^5.0.504",
|
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^90.0
|
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^90.3.0",
|
|
68
68
|
"@sprucelabs/mercury-client": "^31.0.183",
|
|
69
69
|
"@sprucelabs/mercury-core-events": "^12.0.184",
|
|
70
70
|
"@sprucelabs/mercury-event-emitter": "^31.0.183",
|
|
71
71
|
"@sprucelabs/schema": "^28.4.35",
|
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^34.2.85",
|
|
73
73
|
"@sprucelabs/spruce-event-utils": "^27.0.158",
|
|
74
|
-
"@sprucelabs/spruce-skill-booter": "^49.0.
|
|
74
|
+
"@sprucelabs/spruce-skill-booter": "^49.0.16",
|
|
75
75
|
"@sprucelabs/spruce-skill-utils": "^26.4.61",
|
|
76
76
|
"dotenv": "^16.0.2",
|
|
77
77
|
"unique-names-generator": "^4.7.1"
|
|
@@ -131,5 +131,5 @@
|
|
|
131
131
|
]
|
|
132
132
|
]
|
|
133
133
|
},
|
|
134
|
-
"gitHead": "
|
|
134
|
+
"gitHead": "5ad79236efbc3560f859a22fb0b485431fc71577"
|
|
135
135
|
}
|