@sprucelabs/spruce-test-fixtures 59.1.6 → 59.1.7
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/faking/FakingLocations.test.d.ts +4 -0
- package/build/__tests__/behavioral/faking/FakingLocations.test.js +31 -0
- package/build/esm/__tests__/behavioral/faking/FakingLocations.test.d.ts +4 -0
- package/build/esm/__tests__/behavioral/faking/FakingLocations.test.js +37 -0
- package/build/esm/tests/decorators/fake.js +1 -1
- package/build/tests/decorators/fake.js +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
13
|
+
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
|
|
14
|
+
const fake_1 = __importDefault(require("../../../tests/decorators/fake"));
|
|
15
|
+
const seed_1 = __importDefault(require("../../../tests/decorators/seed"));
|
|
16
|
+
let FakingLocationsTest = class FakingLocationsTest extends AbstractSpruceFixtureTest_1.default {
|
|
17
|
+
static async listingLocationsWithoutTargetGetsAllLocations() {
|
|
18
|
+
const [{ locations }] = await this.fakedClient.emitAndFlattenResponses('list-locations::v2020_12_25');
|
|
19
|
+
test_utils_1.assert.isEqualDeep(locations, this.fakedLocations);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
__decorate([
|
|
23
|
+
(0, test_utils_1.test)(),
|
|
24
|
+
(0, seed_1.default)('locations', 1),
|
|
25
|
+
(0, seed_1.default)('organizations', 1),
|
|
26
|
+
(0, seed_1.default)('locations', 1)
|
|
27
|
+
], FakingLocationsTest, "listingLocationsWithoutTargetGetsAllLocations", null);
|
|
28
|
+
FakingLocationsTest = __decorate([
|
|
29
|
+
fake_1.default.login()
|
|
30
|
+
], FakingLocationsTest);
|
|
31
|
+
exports.default = FakingLocationsTest;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
8
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
9
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
10
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
11
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
12
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
13
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
14
|
+
});
|
|
15
|
+
};
|
|
16
|
+
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
18
|
+
import fake from '../../../tests/decorators/fake.js';
|
|
19
|
+
import seed from '../../../tests/decorators/seed.js';
|
|
20
|
+
let FakingLocationsTest = class FakingLocationsTest extends AbstractSpruceFixtureTest {
|
|
21
|
+
static listingLocationsWithoutTargetGetsAllLocations() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const [{ locations }] = yield this.fakedClient.emitAndFlattenResponses('list-locations::v2020_12_25');
|
|
24
|
+
assert.isEqualDeep(locations, this.fakedLocations);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
__decorate([
|
|
29
|
+
test(),
|
|
30
|
+
seed('locations', 1),
|
|
31
|
+
seed('organizations', 1),
|
|
32
|
+
seed('locations', 1)
|
|
33
|
+
], FakingLocationsTest, "listingLocationsWithoutTargetGetsAllLocations", null);
|
|
34
|
+
FakingLocationsTest = __decorate([
|
|
35
|
+
fake.login()
|
|
36
|
+
], FakingLocationsTest);
|
|
37
|
+
export default FakingLocationsTest;
|
|
@@ -368,7 +368,7 @@ function fakeListLocations(Class) {
|
|
|
368
368
|
return __awaiter(this, void 0, void 0, function* () {
|
|
369
369
|
yield eventFaker.on('list-locations::v2020_12_25', ({ target, payload }) => {
|
|
370
370
|
return {
|
|
371
|
-
locations: applyPaging(Class._fakedLocations, payload).filter((l) => l.organizationId === (target === null || target === void 0 ? void 0 : target.organizationId)),
|
|
371
|
+
locations: applyPaging(Class._fakedLocations, payload).filter((l) => !(target === null || target === void 0 ? void 0 : target.organizationId) || l.organizationId === (target === null || target === void 0 ? void 0 : target.organizationId)),
|
|
372
372
|
};
|
|
373
373
|
});
|
|
374
374
|
});
|
|
@@ -347,7 +347,7 @@ function getFakedRecordsByRoleBase(Class, base) {
|
|
|
347
347
|
async function fakeListLocations(Class) {
|
|
348
348
|
await eventFaker_1.default.on('list-locations::v2020_12_25', ({ target, payload }) => {
|
|
349
349
|
return {
|
|
350
|
-
locations: applyPaging(Class._fakedLocations, payload).filter((l) => l.organizationId === (target === null || target === void 0 ? void 0 : target.organizationId)),
|
|
350
|
+
locations: applyPaging(Class._fakedLocations, payload).filter((l) => !(target === null || target === void 0 ? void 0 : target.organizationId) || l.organizationId === (target === null || target === void 0 ? void 0 : target.organizationId)),
|
|
351
351
|
};
|
|
352
352
|
});
|
|
353
353
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "59.1.
|
|
16
|
+
"version": "59.1.7",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^38.1.53",
|
|
73
73
|
"@sprucelabs/spruce-event-utils": "^37.0.69",
|
|
74
74
|
"@sprucelabs/spruce-permission-utils": "^5.0.139",
|
|
75
|
-
"@sprucelabs/spruce-skill-booter": "^59.1.
|
|
75
|
+
"@sprucelabs/spruce-skill-booter": "^59.1.7",
|
|
76
76
|
"@sprucelabs/spruce-skill-utils": "^29.1.20",
|
|
77
77
|
"@sprucelabs/test-utils": "^3.4.75",
|
|
78
78
|
"dotenv": "^16.3.1",
|
|
@@ -132,5 +132,5 @@
|
|
|
132
132
|
]
|
|
133
133
|
]
|
|
134
134
|
},
|
|
135
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "603738bcc91dfeafd5777f0c927a1c12f0ba14d1"
|
|
136
136
|
}
|