@sprucelabs/spruce-test-fixtures 49.0.39 → 49.0.42
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/CanUseStoresSetupInBeforeEach.test.js +5 -5
- package/build/__tests__/behavioral/DatabaseFixture.test.d.ts +1 -1
- package/build/__tests__/behavioral/DatabaseFixture.test.js +7 -7
- package/build/__tests__/behavioral/DbResetsAsExpected.test.js +4 -4
- package/build/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +18 -18
- package/build/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +3 -3
- package/build/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +5 -5
- package/build/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +9 -9
- package/build/__tests__/behavioral/FakingEventResponses.test.js +15 -15
- package/build/__tests__/behavioral/FixtureFactory.test.d.ts +1 -1
- package/build/__tests__/behavioral/FixtureFactory.test.js +14 -14
- package/build/__tests__/behavioral/LocationFixture.test.js +17 -17
- package/build/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +11 -11
- package/build/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +3 -3
- package/build/__tests__/behavioral/MercuryFixture.test.js +28 -28
- package/build/__tests__/behavioral/OrganizationFixture.test.js +50 -50
- package/build/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +3 -3
- package/build/__tests__/behavioral/PersonFixture.test.d.ts +1 -1
- package/build/__tests__/behavioral/PersonFixture.test.js +37 -37
- package/build/__tests__/behavioral/PhoneNumberIncrementor.test.js +22 -22
- package/build/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +5 -5
- package/build/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +3 -3
- package/build/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +5 -5
- package/build/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +9 -9
- package/build/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +4 -4
- package/build/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +2 -2
- package/build/__tests__/behavioral/RoleFixture.test.js +15 -15
- package/build/__tests__/behavioral/SeedingData.test.js +43 -43
- package/build/__tests__/behavioral/SkillFixture.test.js +22 -22
- package/build/__tests__/behavioral/StoreFixture.test.d.ts +1 -1
- package/build/__tests__/behavioral/StoreFixture.test.js +20 -20
- package/build/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +11 -11
- package/build/__tests__/behavioral/faking/FakeDecorator.test.js +74 -74
- package/build/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +3 -3
- package/build/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +3 -3
- package/build/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +1 -1
- package/build/__tests__/behavioral/faking/FakeThemeManager.test.js +8 -8
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +6 -6
- package/build/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +15 -15
- package/build/__tests__/behavioral/faking/FakingAuthenticator.test.js +5 -5
- package/build/__tests__/behavioral/faking/FakingInBeforeEach.test.js +5 -5
- package/build/__tests__/behavioral/faking/FakingRoleEvents.test.js +19 -19
- package/build/__tests__/behavioral/faking/FakingSkillEvents.test.js +41 -41
- package/build/__tests__/behavioral/faking/UpdatePerson.test.js +5 -5
- package/build/__tests__/behavioral/faking/UsingFakeDecorators.test.js +60 -60
- package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +1 -1
- package/build/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +4 -4
- package/build/__tests__/behavioral/faking/WhoAmI.test.js +12 -12
- package/build/__tests__/behavioral/maps/SpyingMapUtil.test.js +17 -17
- package/build/__tests__/behavioral/seeding/UsingDecorators.test.js +54 -54
- package/build/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +16 -16
- package/build/__tests__/behavioral/views/CheckingPermissions.test.js +30 -30
- package/build/__tests__/behavioral/views/FakingSkillViewControllers.test.js +8 -8
- package/build/__tests__/behavioral/views/Routing.test.js +30 -30
- package/build/__tests__/behavioral/views/TestingScope.test.js +10 -10
- package/build/__tests__/behavioral/views/ViewFixture.test.js +107 -107
- package/build/__tests__/behavioral/views/WorkingWithTimezones.test.js +10 -10
- package/build/__tests__/support/AbstractFakeDecoratorTest.js +4 -4
- package/build/esm/__tests__/behavioral/CanUseStoresSetupInBeforeEach.test.js +1 -1
- package/build/esm/__tests__/behavioral/DatabaseFixture.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/DatabaseFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/DbResetsAsExpected.test.js +1 -1
- package/build/esm/__tests__/behavioral/DecoratoringEmitToPassThroughProxy.test.js +1 -1
- package/build/esm/__tests__/behavioral/DelaysConnectWhenOnlyUsingLoginDecorator.test.js +1 -1
- package/build/esm/__tests__/behavioral/DisablingSchemaValidationOnTest.test.js +1 -1
- package/build/esm/__tests__/behavioral/DoesntResetAccountIfOnlySeedingLocally.test.js +1 -1
- package/build/esm/__tests__/behavioral/FakingEventResponses.test.js +1 -1
- package/build/esm/__tests__/behavioral/FixtureFactory.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/FixtureFactory.test.js +1 -1
- package/build/esm/__tests__/behavioral/LocationFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/LoginDecoratorHandlingProxiesForMe.test.js +1 -1
- package/build/esm/__tests__/behavioral/MakingSureLocalEventsAreHandledLocally.test.js +1 -1
- package/build/esm/__tests__/behavioral/MercuryFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/OrganizationFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/PatchingConsoleErrorToErrorStream.test.js +1 -1
- package/build/esm/__tests__/behavioral/PersonFixture.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/PersonFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/PhoneNumberIncrementor.test.js +1 -1
- package/build/esm/__tests__/behavioral/ResettingAccountLocationsInBeforeAll.test.js +1 -1
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInAfterAll.test.js +1 -1
- package/build/esm/__tests__/behavioral/ResettingAccountOrgsInBeforeAll.test.js +1 -1
- package/build/esm/__tests__/behavioral/ResettingFixtureFieldsBeforeEach.test.js +1 -1
- package/build/esm/__tests__/behavioral/ResettingLocalEventListeningBeforeSeeding.test.js +1 -1
- package/build/esm/__tests__/behavioral/RetainsContractWhenLoggingInUsingDecotorator.test.js +1 -1
- package/build/esm/__tests__/behavioral/RoleFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/SeedingData.test.js +1 -1
- package/build/esm/__tests__/behavioral/SkillFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/StoreFixture.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/StoreFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/AuthenticatingAsAPerson.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorSetsPerson.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakeDecoratorWhoAmI.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/faking/FakeThemeManager.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToALocation.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingAddingPeopleToAnOrg.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingAuthenticator.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingInBeforeEach.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingRoleEvents.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/FakingSkillEvents.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/UpdatePerson.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/UsingFakeDecorators.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.d.ts +1 -1
- package/build/esm/__tests__/behavioral/faking/UsingFakesOnIncompatibleClass.test.js +1 -1
- package/build/esm/__tests__/behavioral/faking/WhoAmI.test.js +1 -1
- package/build/esm/__tests__/behavioral/maps/SpyingMapUtil.test.js +1 -1
- package/build/esm/__tests__/behavioral/seeding/UsingDecorators.test.js +1 -1
- package/build/esm/__tests__/behavioral/seeding/UsingDecoratorsToInstallSkills.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/CheckingPermissions.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/FakingSkillViewControllers.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/Routing.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/TestingScope.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +1 -1
- package/build/esm/__tests__/behavioral/views/WorkingWithTimezones.test.js +1 -1
- package/build/esm/__tests__/support/AbstractFakeDecoratorTest.js +1 -1
- package/build/esm/tests/AbstractSpruceFixtureTest.js +1 -1
- package/build/esm/tests/SpyAuthorizer.js +1 -1
- package/build/esm/tests/decorators/fake.js +1 -1
- package/build/esm/tests/decorators/install.js +1 -1
- package/build/esm/tests/decorators/login.js +1 -1
- package/build/esm/tests/decorators/seed.js +1 -1
- package/build/esm/tests/fixtures/LocationFixture.js +1 -1
- package/build/esm/tests/fixtures/RoleFixture.js +1 -1
- package/build/esm/tests/fixtures/SeedFixture.js +1 -1
- package/build/tests/AbstractSpruceFixtureTest.js +3 -3
- package/build/tests/SpyAuthorizer.js +3 -3
- package/build/tests/decorators/fake.js +20 -20
- package/build/tests/decorators/install.js +3 -3
- package/build/tests/decorators/login.js +4 -4
- package/build/tests/decorators/seed.js +2 -2
- package/build/tests/fixtures/LocationFixture.js +3 -3
- package/build/tests/fixtures/RoleFixture.js +2 -2
- package/build/tests/fixtures/SeedFixture.js +2 -2
- package/package.json +5 -5
|
@@ -10,8 +10,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
|
|
13
|
-
const test_1 = require("@sprucelabs/test");
|
|
14
13
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
14
|
+
const test_utils_2 = require("@sprucelabs/test-utils");
|
|
15
15
|
const __1 = require("../..");
|
|
16
16
|
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../tests/AbstractSpruceFixtureTest"));
|
|
17
17
|
const constants_1 = require("../../tests/constants");
|
|
@@ -23,14 +23,14 @@ let SkillFixtureTest = class SkillFixtureTest extends AbstractSpruceFixtureTest_
|
|
|
23
23
|
delete process.env.SKILL_API_KEY;
|
|
24
24
|
}
|
|
25
25
|
static async canCreateSkillFixture() {
|
|
26
|
-
|
|
26
|
+
test_utils_1.assert.isTruthy(this.fixture);
|
|
27
27
|
}
|
|
28
28
|
static async canSeedSkill() {
|
|
29
29
|
const skill = await this.fixture.seedDemoSkill({
|
|
30
30
|
name: 'skill1',
|
|
31
31
|
});
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
test_utils_1.assert.isTruthy(skill);
|
|
33
|
+
test_utils_1.assert.isEqual(skill.name, 'skill1');
|
|
34
34
|
}
|
|
35
35
|
static async cleansUpSkillsAndNotCrashWithMultileDestroys() {
|
|
36
36
|
const skill = await this.fixture.seedDemoSkill({
|
|
@@ -47,15 +47,15 @@ let SkillFixtureTest = class SkillFixtureTest extends AbstractSpruceFixtureTest_
|
|
|
47
47
|
spruce_event_utils_1.eventAssertUtil.assertErrorFromResponse(results, 'INVALID_TARGET');
|
|
48
48
|
}
|
|
49
49
|
static async cantLoginAsCurrentSkillIfSkillNotConfigured() {
|
|
50
|
-
const err = await
|
|
51
|
-
|
|
50
|
+
const err = await test_utils_1.assert.doesThrowAsync(() => this.fixture.loginAsCurrentSkill());
|
|
51
|
+
test_utils_2.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
52
52
|
parameters: ['env.SKILL_ID', 'env.SKILL_API_KEY'],
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
static async cantLoginAsCurrentSkillIfSkillNotConfiguredWithApiKey() {
|
|
56
56
|
process.env.SKILL_ID = '123';
|
|
57
|
-
const err = await
|
|
58
|
-
|
|
57
|
+
const err = await test_utils_1.assert.doesThrowAsync(() => this.fixture.loginAsCurrentSkill());
|
|
58
|
+
test_utils_2.errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
59
59
|
parameters: ['env.SKILL_API_KEY'],
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -66,10 +66,10 @@ let SkillFixtureTest = class SkillFixtureTest extends AbstractSpruceFixtureTest_
|
|
|
66
66
|
process.env.SKILL_ID = demoSkill.id;
|
|
67
67
|
process.env.SKILL_API_KEY = demoSkill.apiKey;
|
|
68
68
|
const { skill, client } = await this.fixture.loginAsCurrentSkill();
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
test_utils_1.assert.isTruthy(skill);
|
|
70
|
+
test_utils_1.assert.isTruthy(client);
|
|
71
|
+
test_utils_1.assert.isEqual(skill.id, demoSkill.id);
|
|
72
|
+
test_utils_1.assert.isEqual(skill.apiKey, demoSkill.apiKey);
|
|
73
73
|
}
|
|
74
74
|
static async shouldUnRegisterDemoSkills() {
|
|
75
75
|
const { client } = await this.fixture.loginAsDemoSkill({
|
|
@@ -77,38 +77,38 @@ let SkillFixtureTest = class SkillFixtureTest extends AbstractSpruceFixtureTest_
|
|
|
77
77
|
});
|
|
78
78
|
await this.fixture.destroy();
|
|
79
79
|
const results = await client.emit('whoami::v2020_12_25');
|
|
80
|
-
|
|
80
|
+
test_utils_1.assert.doesThrow(() => spruce_event_utils_1.eventResponseUtil.getFirstResponseOrThrow(results));
|
|
81
81
|
}
|
|
82
82
|
static canPassThroughPersonFixture() {
|
|
83
83
|
const personFixture = this.Fixture('person');
|
|
84
84
|
const fixture = this.Fixture('skill', { personFixture });
|
|
85
85
|
//@ts-ignore
|
|
86
|
-
|
|
86
|
+
test_utils_1.assert.isEqual(fixture.personFixture, personFixture);
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
__decorate([
|
|
90
|
-
(0,
|
|
90
|
+
(0, test_utils_1.test)()
|
|
91
91
|
], SkillFixtureTest, "canCreateSkillFixture", null);
|
|
92
92
|
__decorate([
|
|
93
|
-
(0,
|
|
93
|
+
(0, test_utils_1.test)()
|
|
94
94
|
], SkillFixtureTest, "canSeedSkill", null);
|
|
95
95
|
__decorate([
|
|
96
|
-
(0,
|
|
96
|
+
(0, test_utils_1.test)()
|
|
97
97
|
], SkillFixtureTest, "cleansUpSkillsAndNotCrashWithMultileDestroys", null);
|
|
98
98
|
__decorate([
|
|
99
|
-
(0,
|
|
99
|
+
(0, test_utils_1.test)()
|
|
100
100
|
], SkillFixtureTest, "cantLoginAsCurrentSkillIfSkillNotConfigured", null);
|
|
101
101
|
__decorate([
|
|
102
|
-
(0,
|
|
102
|
+
(0, test_utils_1.test)()
|
|
103
103
|
], SkillFixtureTest, "cantLoginAsCurrentSkillIfSkillNotConfiguredWithApiKey", null);
|
|
104
104
|
__decorate([
|
|
105
|
-
(0,
|
|
105
|
+
(0, test_utils_1.test)()
|
|
106
106
|
], SkillFixtureTest, "canLoginAsCurrentSkill", null);
|
|
107
107
|
__decorate([
|
|
108
|
-
(0,
|
|
108
|
+
(0, test_utils_1.test)()
|
|
109
109
|
], SkillFixtureTest, "shouldUnRegisterDemoSkills", null);
|
|
110
110
|
__decorate([
|
|
111
|
-
(0,
|
|
111
|
+
(0, test_utils_1.test)()
|
|
112
112
|
], SkillFixtureTest, "canPassThroughPersonFixture", null);
|
|
113
113
|
SkillFixtureTest = __decorate([
|
|
114
114
|
(0, __1.login)(constants_1.DEMO_NUMBER_SKILL_FIXTURE)
|
|
@@ -33,10 +33,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
const data_stores_1 = require("@sprucelabs/data-stores");
|
|
36
|
-
const
|
|
36
|
+
const test_utils_1 = __importStar(require("@sprucelabs/test-utils"));
|
|
37
37
|
const FixtureFactory_1 = __importDefault(require("../../tests/fixtures/FixtureFactory"));
|
|
38
38
|
const StoreFixture_1 = __importDefault(require("../../tests/fixtures/StoreFixture"));
|
|
39
|
-
class StoreFixtureTest extends
|
|
39
|
+
class StoreFixtureTest extends test_utils_1.default {
|
|
40
40
|
static async beforeAll() {
|
|
41
41
|
await super.beforeAll();
|
|
42
42
|
this.originalDestroy = data_stores_1.DatabaseFixture.destroy.bind(data_stores_1.DatabaseFixture);
|
|
@@ -48,7 +48,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
48
48
|
data_stores_1.DatabaseFixture.afterEach = this.originalAfterEach;
|
|
49
49
|
}
|
|
50
50
|
static async canGetFixture() {
|
|
51
|
-
|
|
51
|
+
test_utils_1.assert.isTruthy(this.FixtureFactory().Fixture('store'));
|
|
52
52
|
}
|
|
53
53
|
static async canGetFunctioningStores() {
|
|
54
54
|
this.setStoreDirToOneGoodStore();
|
|
@@ -57,7 +57,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
57
57
|
data_stores_1.StoreLoader.setDatabase(db);
|
|
58
58
|
const fixture = this.FixtureFactory().Fixture('store');
|
|
59
59
|
const goodStore = await fixture.Store('good');
|
|
60
|
-
|
|
60
|
+
test_utils_1.assert.isTruthy(goodStore);
|
|
61
61
|
}
|
|
62
62
|
static async beforeAllCallsBeforeAllOnDatabaseFixture() {
|
|
63
63
|
let wasHit = false;
|
|
@@ -66,7 +66,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
66
66
|
wasHit = true;
|
|
67
67
|
};
|
|
68
68
|
await StoreFixture_1.default.beforeAll();
|
|
69
|
-
|
|
69
|
+
test_utils_1.assert.isTrue(wasHit);
|
|
70
70
|
}
|
|
71
71
|
static async beforeEachCallsDestroyOnDatabaseFixture() {
|
|
72
72
|
let wasHit = false;
|
|
@@ -75,7 +75,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
75
75
|
wasHit = true;
|
|
76
76
|
};
|
|
77
77
|
await StoreFixture_1.default.beforeEach();
|
|
78
|
-
|
|
78
|
+
test_utils_1.assert.isTrue(wasHit);
|
|
79
79
|
}
|
|
80
80
|
static async afterEachCallsAfterEachOnDatabaseFixture() {
|
|
81
81
|
let wasHit = false;
|
|
@@ -84,14 +84,14 @@ class StoreFixtureTest extends test_1.default {
|
|
|
84
84
|
wasHit = true;
|
|
85
85
|
};
|
|
86
86
|
await StoreFixture_1.default.afterEach();
|
|
87
|
-
|
|
87
|
+
test_utils_1.assert.isTrue(wasHit);
|
|
88
88
|
}
|
|
89
89
|
static async storeLoaderUsesNewInstanceOfDbEachRun() {
|
|
90
90
|
const loader1 = await data_stores_1.StoreLoader.getInstance();
|
|
91
91
|
await StoreFixture_1.default.beforeEach();
|
|
92
92
|
const loader2 = await data_stores_1.StoreLoader.getInstance();
|
|
93
93
|
//@ts-ignore
|
|
94
|
-
|
|
94
|
+
test_utils_1.assert.isNotEqual(loader1.db, loader2.db);
|
|
95
95
|
}
|
|
96
96
|
static async storeFixtureCallsResetOnStoreFactory() {
|
|
97
97
|
let wasHit = false;
|
|
@@ -100,7 +100,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
100
100
|
wasHit = true;
|
|
101
101
|
};
|
|
102
102
|
await StoreFixture_1.default.beforeEach();
|
|
103
|
-
|
|
103
|
+
test_utils_1.assert.isTrue(wasHit);
|
|
104
104
|
}
|
|
105
105
|
static async callsBeforeEachOnCursorFaker() {
|
|
106
106
|
let wasHit = false;
|
|
@@ -109,7 +109,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
109
109
|
wasHit = true;
|
|
110
110
|
};
|
|
111
111
|
await StoreFixture_1.default.beforeEach();
|
|
112
|
-
|
|
112
|
+
test_utils_1.assert.isTrue(wasHit);
|
|
113
113
|
}
|
|
114
114
|
static async canGetStore() {
|
|
115
115
|
this.setStoreDirToOneGoodStore();
|
|
@@ -117,7 +117,7 @@ class StoreFixtureTest extends test_1.default {
|
|
|
117
117
|
const stores = await fixture.getStoreFactory();
|
|
118
118
|
const store1 = await stores.getStore('good');
|
|
119
119
|
const store2 = await fixture.getStore('good');
|
|
120
|
-
|
|
120
|
+
test_utils_1.assert.isEqual(store1, store2);
|
|
121
121
|
}
|
|
122
122
|
static setStoreDirToOneGoodStore() {
|
|
123
123
|
data_stores_1.StoreLoader.setStoreDir(this.resolvePath(__dirname, '..', 'testDirsAndFiles', 'one-good-store-skill', 'build'));
|
|
@@ -127,30 +127,30 @@ class StoreFixtureTest extends test_1.default {
|
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
__decorate([
|
|
130
|
-
(0,
|
|
130
|
+
(0, test_utils_1.test)()
|
|
131
131
|
], StoreFixtureTest, "canGetFixture", null);
|
|
132
132
|
__decorate([
|
|
133
|
-
(0,
|
|
133
|
+
(0, test_utils_1.test)()
|
|
134
134
|
], StoreFixtureTest, "canGetFunctioningStores", null);
|
|
135
135
|
__decorate([
|
|
136
|
-
(0,
|
|
136
|
+
(0, test_utils_1.test)()
|
|
137
137
|
], StoreFixtureTest, "beforeAllCallsBeforeAllOnDatabaseFixture", null);
|
|
138
138
|
__decorate([
|
|
139
|
-
(0,
|
|
139
|
+
(0, test_utils_1.test)()
|
|
140
140
|
], StoreFixtureTest, "beforeEachCallsDestroyOnDatabaseFixture", null);
|
|
141
141
|
__decorate([
|
|
142
|
-
(0,
|
|
142
|
+
(0, test_utils_1.test)()
|
|
143
143
|
], StoreFixtureTest, "afterEachCallsAfterEachOnDatabaseFixture", null);
|
|
144
144
|
__decorate([
|
|
145
|
-
(0,
|
|
145
|
+
(0, test_utils_1.test)()
|
|
146
146
|
], StoreFixtureTest, "storeLoaderUsesNewInstanceOfDbEachRun", null);
|
|
147
147
|
__decorate([
|
|
148
|
-
(0,
|
|
148
|
+
(0, test_utils_1.test)()
|
|
149
149
|
], StoreFixtureTest, "storeFixtureCallsResetOnStoreFactory", null);
|
|
150
150
|
__decorate([
|
|
151
|
-
(0,
|
|
151
|
+
(0, test_utils_1.test)()
|
|
152
152
|
], StoreFixtureTest, "callsBeforeEachOnCursorFaker", null);
|
|
153
153
|
__decorate([
|
|
154
|
-
(0,
|
|
154
|
+
(0, test_utils_1.test)()
|
|
155
155
|
], StoreFixtureTest, "canGetStore", null);
|
|
156
156
|
exports.default = StoreFixtureTest;
|
|
@@ -10,25 +10,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const spruce_event_utils_1 = require("@sprucelabs/spruce-event-utils");
|
|
13
|
-
const
|
|
13
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
14
14
|
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
|
|
15
15
|
const fake_1 = __importDefault(require("../../../tests/decorators/fake"));
|
|
16
16
|
let AuthenticatingAsAPersonTest = class AuthenticatingAsAPersonTest extends AbstractSpruceFixtureTest_1.default {
|
|
17
17
|
static async throwsWithBadToken() {
|
|
18
|
-
const err = await
|
|
18
|
+
const err = await test_utils_1.assert.doesThrowAsync(() => fake_1.default.getClient().authenticate({ token: 'aoeuaou' }));
|
|
19
19
|
spruce_event_utils_1.eventAssertUtil.assertError(err, 'INVALID_AUTH_TOKEN');
|
|
20
20
|
}
|
|
21
21
|
static async canAuthenticateAsAPerson() {
|
|
22
22
|
const { token, person } = await this.people.loginAsDemoPerson();
|
|
23
23
|
const { person: person2 } = await fake_1.default.getClient().authenticate({ token });
|
|
24
|
-
|
|
24
|
+
test_utils_1.assert.isEqualDeep(person, person2);
|
|
25
25
|
}
|
|
26
26
|
static async authReturnsExpectedPerson() {
|
|
27
27
|
await this.people.loginAsDemoPerson();
|
|
28
28
|
const { token, person } = await this.people.loginAsDemoPerson('555-111-1234');
|
|
29
29
|
const client = await this.connectAnon();
|
|
30
30
|
const { person: person2 } = await client.authenticate({ token });
|
|
31
|
-
|
|
31
|
+
test_utils_1.assert.isEqualDeep(person, person2);
|
|
32
32
|
}
|
|
33
33
|
static async authReturnsProperType() {
|
|
34
34
|
var _a;
|
|
@@ -39,31 +39,31 @@ let AuthenticatingAsAPersonTest = class AuthenticatingAsAPersonTest extends Abst
|
|
|
39
39
|
token: (_a = this.fakedTokens[0]) === null || _a === void 0 ? void 0 : _a.token,
|
|
40
40
|
},
|
|
41
41
|
});
|
|
42
|
-
|
|
42
|
+
test_utils_1.assert.isEqual(type, 'authenticated');
|
|
43
43
|
}
|
|
44
44
|
static async tokenAlwaysDifferent() {
|
|
45
45
|
const { token: token1 } = await this.people.loginAsDemoPerson();
|
|
46
46
|
const { token: token2 } = await this.people.loginAsDemoPerson('555-111-1234');
|
|
47
|
-
|
|
47
|
+
test_utils_1.assert.isNotEqual(token1, token2);
|
|
48
48
|
}
|
|
49
49
|
static async connectAnon() {
|
|
50
50
|
return await this.mercury.connectToApi({ shouldReUseClient: false });
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
__decorate([
|
|
54
|
-
(0,
|
|
54
|
+
(0, test_utils_1.test)()
|
|
55
55
|
], AuthenticatingAsAPersonTest, "throwsWithBadToken", null);
|
|
56
56
|
__decorate([
|
|
57
|
-
(0,
|
|
57
|
+
(0, test_utils_1.test)()
|
|
58
58
|
], AuthenticatingAsAPersonTest, "canAuthenticateAsAPerson", null);
|
|
59
59
|
__decorate([
|
|
60
|
-
(0,
|
|
60
|
+
(0, test_utils_1.test)()
|
|
61
61
|
], AuthenticatingAsAPersonTest, "authReturnsExpectedPerson", null);
|
|
62
62
|
__decorate([
|
|
63
|
-
(0,
|
|
63
|
+
(0, test_utils_1.test)()
|
|
64
64
|
], AuthenticatingAsAPersonTest, "authReturnsProperType", null);
|
|
65
65
|
__decorate([
|
|
66
|
-
(0,
|
|
66
|
+
(0, test_utils_1.test)()
|
|
67
67
|
], AuthenticatingAsAPersonTest, "tokenAlwaysDifferent", null);
|
|
68
68
|
AuthenticatingAsAPersonTest = __decorate([
|
|
69
69
|
fake_1.default.login()
|