@sprucelabs/spruce-test-fixtures 52.4.6 → 52.5.0

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.
Files changed (29) hide show
  1. package/build/__tests__/behavioral/{views/CheckingPermissions.test.d.ts → PermissionFixture.test.d.ts} +4 -1
  2. package/build/__tests__/behavioral/{views/CheckingPermissions.test.js → PermissionFixture.test.js} +27 -6
  3. package/build/__tests__/behavioral/faking/FakeDecorator.test.d.ts +0 -1
  4. package/build/__tests__/behavioral/faking/FakeDecorator.test.js +0 -7
  5. package/build/__tests__/behavioral/views/ViewFixture.test.d.ts +0 -1
  6. package/build/__tests__/behavioral/views/ViewFixture.test.js +0 -14
  7. package/build/esm/__tests__/behavioral/{views/CheckingPermissions.test.d.ts → PermissionFixture.test.d.ts} +4 -1
  8. package/build/esm/__tests__/behavioral/{views/CheckingPermissions.test.js → PermissionFixture.test.js} +31 -6
  9. package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.d.ts +0 -1
  10. package/build/esm/__tests__/behavioral/faking/FakeDecorator.test.js +0 -9
  11. package/build/esm/__tests__/behavioral/views/ViewFixture.test.d.ts +0 -1
  12. package/build/esm/__tests__/behavioral/views/ViewFixture.test.js +1 -17
  13. package/build/esm/tests/AbstractSpruceFixtureTest.d.ts +4 -0
  14. package/build/esm/tests/AbstractSpruceFixtureTest.js +9 -0
  15. package/build/esm/tests/fixtures/FixtureFactory.js +3 -0
  16. package/build/esm/tests/fixtures/PermissionFixture.d.ts +3 -0
  17. package/build/esm/tests/fixtures/PermissionFixture.js +8 -0
  18. package/build/esm/tests/fixtures/ViewFixture.d.ts +6 -0
  19. package/build/esm/tests/fixtures/ViewFixture.js +6 -0
  20. package/build/esm/types/fixture.types.d.ts +2 -0
  21. package/build/tests/AbstractSpruceFixtureTest.d.ts +4 -0
  22. package/build/tests/AbstractSpruceFixtureTest.js +9 -0
  23. package/build/tests/fixtures/FixtureFactory.js +3 -0
  24. package/build/tests/fixtures/PermissionFixture.d.ts +3 -0
  25. package/build/tests/fixtures/PermissionFixture.js +11 -0
  26. package/build/tests/fixtures/ViewFixture.d.ts +6 -0
  27. package/build/tests/fixtures/ViewFixture.js +6 -0
  28. package/build/types/fixture.types.d.ts +2 -0
  29. package/package.json +3 -3
@@ -1,4 +1,4 @@
1
- import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
1
+ import AbstractSpruceFixtureTest from '../../tests/AbstractSpruceFixtureTest';
2
2
  export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
3
3
  private static contractId;
4
4
  protected static beforeEach(): Promise<void>;
@@ -16,10 +16,13 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
16
16
  protected static authorizerClobbersMatchingContracts(): Promise<void>;
17
17
  protected static usesLatestMatchWhenMultipleSent(): Promise<void>;
18
18
  protected static canHandleMulplePermissionsWithDifferentContracts(): Promise<void>;
19
+ protected static sameAuthorizerAsViews(): Promise<void>;
20
+ protected static sameAuthenticatorAsViews(): Promise<void>;
19
21
  private static assertPermNotFound;
20
22
  private static changeContractId;
21
23
  private static assertThrowsFakeError;
22
24
  private static fakePermissions;
23
25
  private static can;
26
+ private static setupEmptyViewFixture;
24
27
  private static get instance();
25
28
  }
@@ -11,9 +11,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const test_utils_1 = require("@sprucelabs/test-utils");
13
13
  const test_utils_2 = require("@sprucelabs/test-utils");
14
- const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
15
- const FakeAuthorizer_1 = __importDefault(require("../../../tests/FakeAuthorizer"));
16
- const ViewFixture_1 = __importDefault(require("../../../tests/fixtures/ViewFixture"));
14
+ const AbstractSpruceFixtureTest_1 = __importDefault(require("../../tests/AbstractSpruceFixtureTest"));
15
+ const FakeAuthorizer_1 = __importDefault(require("../../tests/FakeAuthorizer"));
16
+ const ViewFixture_1 = __importDefault(require("../../tests/fixtures/ViewFixture"));
17
17
  class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
18
18
  static async beforeEach() {
19
19
  await super.beforeEach();
@@ -69,9 +69,7 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
69
69
  test_utils_1.assert.isEqualDeep(results, expected);
70
70
  }
71
71
  static async fixtureAndLoadOptionsShareAuthorizer() {
72
- this.views = this.Fixture('view', {
73
- controllerMap: {},
74
- });
72
+ this.setupEmptyViewFixture();
75
73
  const auth = this.views.getAuthorizer();
76
74
  const router = this.views.getRouter();
77
75
  test_utils_1.assert.isEqual(auth, router.buildLoadOptions().authorizer);
@@ -104,6 +102,18 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
104
102
  const perms = await this.can(['test']);
105
103
  test_utils_1.assert.isTrue(perms['test']);
106
104
  }
105
+ static async sameAuthorizerAsViews() {
106
+ this.setupEmptyViewFixture();
107
+ const auth1 = this.views.getAuthorizer();
108
+ const auth2 = this.permissions.getAuthorizer();
109
+ test_utils_1.assert.isEqual(auth1, auth2);
110
+ }
111
+ static async sameAuthenticatorAsViews() {
112
+ this.setupEmptyViewFixture();
113
+ const auth1 = this.views.getAuthenticator();
114
+ const auth2 = this.permissions.getAuthenticator();
115
+ test_utils_1.assert.isEqual(auth1, auth2);
116
+ }
107
117
  static async assertPermNotFound(checkIds, id) {
108
118
  await test_utils_1.assert.doesThrowAsync(() => this.can(checkIds), id);
109
119
  }
@@ -125,6 +135,11 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
125
135
  permissionIds: permissionIds,
126
136
  });
127
137
  }
138
+ static setupEmptyViewFixture() {
139
+ this.views = this.Fixture('view', {
140
+ controllerMap: {},
141
+ });
142
+ }
128
143
  static get instance() {
129
144
  return FakeAuthorizer_1.default.getInstance();
130
145
  }
@@ -174,4 +189,10 @@ __decorate([
174
189
  __decorate([
175
190
  (0, test_utils_1.test)()
176
191
  ], CheckingPermissionsTest, "canHandleMulplePermissionsWithDifferentContracts", null);
192
+ __decorate([
193
+ (0, test_utils_1.test)()
194
+ ], CheckingPermissionsTest, "sameAuthorizerAsViews", null);
195
+ __decorate([
196
+ (0, test_utils_1.test)()
197
+ ], CheckingPermissionsTest, "sameAuthenticatorAsViews", null);
177
198
  exports.default = CheckingPermissionsTest;
@@ -6,7 +6,6 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
6
6
  protected static doesNotThrowWhenMissingPhone(): void;
7
7
  protected static throwsWhenInvalidPhone(): void;
8
8
  protected static fakingLoginSetsRequireLocalListeners(): Promise<void>;
9
- protected static setsOwnerToClass(): Promise<void>;
10
9
  protected static getPersonThrowsWithoutPersonId(): Promise<void>;
11
10
  protected static fakesGetPerson(): Promise<void>;
12
11
  protected static getPersonThrowsWithBadId(): Promise<void>;
@@ -57,10 +57,6 @@ class FakeDecoratorTest extends AbstractFakeDecoratorTest_1.default {
57
57
  await this.fakeLogin(constants_1.DEMO_NUMBER);
58
58
  test_utils_1.assert.isTrue(mercury_client_1.MercuryTestClient.getShouldRequireLocalListeners());
59
59
  }
60
- static async setsOwnerToClass() {
61
- const auth = await this.fakeLoginAndGetAuth();
62
- test_utils_1.assert.isEqualDeep(this.fakedPerson, auth.person);
63
- }
64
60
  static async getPersonThrowsWithoutPersonId() {
65
61
  await this.fakeLogin();
66
62
  await test_utils_1.assert.doesThrowAsync(() => this.client.emitAndFlattenResponses('get-person::v2020_12_25', {
@@ -330,9 +326,6 @@ __decorate([
330
326
  __decorate([
331
327
  (0, test_utils_1.test)()
332
328
  ], FakeDecoratorTest, "fakingLoginSetsRequireLocalListeners", null);
333
- __decorate([
334
- test_utils_1.test.skip()
335
- ], FakeDecoratorTest, "setsOwnerToClass", null);
336
329
  __decorate([
337
330
  (0, test_utils_1.test)()
338
331
  ], FakeDecoratorTest, "getPersonThrowsWithoutPersonId", null);
@@ -28,7 +28,6 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
28
28
  protected static canGetAuthenticatorInstance(): void;
29
29
  protected static activeRecordThrowsByDefault(): void;
30
30
  protected static activeRecordThrowReset(): void;
31
- protected static patchesFormsToThrow(): Promise<void>;
32
31
  protected static loggingInWithViewFixtureSetsProxyTokenForSkill(): Promise<void>;
33
32
  protected static proxyGeneratorIsResetWhenDifferentPersonLogsIn(): Promise<void>;
34
33
  protected static sameProxyAcrossFixturesWithSameNumber(): Promise<void>;
@@ -285,17 +285,6 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest_1.
285
285
  //@ts-ignore
286
286
  test_utils_1.assert.isTrue(heartwood_view_controllers_1.ActiveRecordListViewController.shouldThrowOnResponseError);
287
287
  }
288
- static async patchesFormsToThrow() {
289
- const viewFixture = this.Fixture('view', {
290
- controllerMap: {},
291
- });
292
- const formVc = viewFixture.Controller('form', (0, heartwood_view_controllers_1.buildForm)({
293
- id: 'test',
294
- schema: { id: 'test', fields: {} },
295
- sections: [],
296
- }));
297
- await test_utils_1.assert.doesThrowAsync(() => formVc.submit());
298
- }
299
288
  static async loggingInWithViewFixtureSetsProxyTokenForSkill() {
300
289
  const { client, token, generator } = await this.loginAndGetProxy();
301
290
  test_utils_1.assert.isTruthy(token);
@@ -548,9 +537,6 @@ __decorate([
548
537
  __decorate([
549
538
  (0, test_utils_1.test)()
550
539
  ], ViewFixtureTest, "activeRecordThrowReset", null);
551
- __decorate([
552
- test_utils_1.test.skip()
553
- ], ViewFixtureTest, "patchesFormsToThrow", null);
554
540
  __decorate([
555
541
  (0, test_utils_1.test)()
556
542
  ], ViewFixtureTest, "loggingInWithViewFixtureSetsProxyTokenForSkill", null);
@@ -1,4 +1,4 @@
1
- import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
1
+ import AbstractSpruceFixtureTest from '../../tests/AbstractSpruceFixtureTest';
2
2
  export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
3
3
  private static contractId;
4
4
  protected static beforeEach(): Promise<void>;
@@ -16,10 +16,13 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
16
16
  protected static authorizerClobbersMatchingContracts(): Promise<void>;
17
17
  protected static usesLatestMatchWhenMultipleSent(): Promise<void>;
18
18
  protected static canHandleMulplePermissionsWithDifferentContracts(): Promise<void>;
19
+ protected static sameAuthorizerAsViews(): Promise<void>;
20
+ protected static sameAuthenticatorAsViews(): Promise<void>;
19
21
  private static assertPermNotFound;
20
22
  private static changeContractId;
21
23
  private static assertThrowsFakeError;
22
24
  private static fakePermissions;
23
25
  private static can;
26
+ private static setupEmptyViewFixture;
24
27
  private static get instance();
25
28
  }
@@ -15,9 +15,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
15
15
  };
16
16
  import { test, assert } from '@sprucelabs/test-utils';
17
17
  import { errorAssert, generateId } from '@sprucelabs/test-utils';
18
- import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
19
- import FakeAuthorizer from '../../../tests/FakeAuthorizer.js';
20
- import ViewFixture from '../../../tests/fixtures/ViewFixture.js';
18
+ import AbstractSpruceFixtureTest from '../../tests/AbstractSpruceFixtureTest.js';
19
+ import FakeAuthorizer from '../../tests/FakeAuthorizer.js';
20
+ import ViewFixture from '../../tests/fixtures/ViewFixture.js';
21
21
  export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
22
22
  static beforeEach() {
23
23
  const _super = Object.create(null, {
@@ -99,9 +99,7 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
99
99
  }
100
100
  static fixtureAndLoadOptionsShareAuthorizer() {
101
101
  return __awaiter(this, void 0, void 0, function* () {
102
- this.views = this.Fixture('view', {
103
- controllerMap: {},
104
- });
102
+ this.setupEmptyViewFixture();
105
103
  const auth = this.views.getAuthorizer();
106
104
  const router = this.views.getRouter();
107
105
  assert.isEqual(auth, router.buildLoadOptions().authorizer);
@@ -141,6 +139,22 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
141
139
  assert.isTrue(perms['test']);
142
140
  });
143
141
  }
142
+ static sameAuthorizerAsViews() {
143
+ return __awaiter(this, void 0, void 0, function* () {
144
+ this.setupEmptyViewFixture();
145
+ const auth1 = this.views.getAuthorizer();
146
+ const auth2 = this.permissions.getAuthorizer();
147
+ assert.isEqual(auth1, auth2);
148
+ });
149
+ }
150
+ static sameAuthenticatorAsViews() {
151
+ return __awaiter(this, void 0, void 0, function* () {
152
+ this.setupEmptyViewFixture();
153
+ const auth1 = this.views.getAuthenticator();
154
+ const auth2 = this.permissions.getAuthenticator();
155
+ assert.isEqual(auth1, auth2);
156
+ });
157
+ }
144
158
  static assertPermNotFound(checkIds, id) {
145
159
  return __awaiter(this, void 0, void 0, function* () {
146
160
  yield assert.doesThrowAsync(() => this.can(checkIds), id);
@@ -166,6 +180,11 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
166
180
  permissionIds: permissionIds,
167
181
  });
168
182
  }
183
+ static setupEmptyViewFixture() {
184
+ this.views = this.Fixture('view', {
185
+ controllerMap: {},
186
+ });
187
+ }
169
188
  static get instance() {
170
189
  return FakeAuthorizer.getInstance();
171
190
  }
@@ -215,3 +234,9 @@ __decorate([
215
234
  __decorate([
216
235
  test()
217
236
  ], CheckingPermissionsTest, "canHandleMulplePermissionsWithDifferentContracts", null);
237
+ __decorate([
238
+ test()
239
+ ], CheckingPermissionsTest, "sameAuthorizerAsViews", null);
240
+ __decorate([
241
+ test()
242
+ ], CheckingPermissionsTest, "sameAuthenticatorAsViews", null);
@@ -6,7 +6,6 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
6
6
  protected static doesNotThrowWhenMissingPhone(): void;
7
7
  protected static throwsWhenInvalidPhone(): void;
8
8
  protected static fakingLoginSetsRequireLocalListeners(): Promise<void>;
9
- protected static setsOwnerToClass(): Promise<void>;
10
9
  protected static getPersonThrowsWithoutPersonId(): Promise<void>;
11
10
  protected static fakesGetPerson(): Promise<void>;
12
11
  protected static getPersonThrowsWithBadId(): Promise<void>;
@@ -45,12 +45,6 @@ export default class FakeDecoratorTest extends AbstractFakeDecoratorTest {
45
45
  assert.isTrue(MercuryTestClient.getShouldRequireLocalListeners());
46
46
  });
47
47
  }
48
- static setsOwnerToClass() {
49
- return __awaiter(this, void 0, void 0, function* () {
50
- const auth = yield this.fakeLoginAndGetAuth();
51
- assert.isEqualDeep(this.fakedPerson, auth.person);
52
- });
53
- }
54
48
  static getPersonThrowsWithoutPersonId() {
55
49
  return __awaiter(this, void 0, void 0, function* () {
56
50
  yield this.fakeLogin();
@@ -392,9 +386,6 @@ __decorate([
392
386
  __decorate([
393
387
  test()
394
388
  ], FakeDecoratorTest, "fakingLoginSetsRequireLocalListeners", null);
395
- __decorate([
396
- test.skip()
397
- ], FakeDecoratorTest, "setsOwnerToClass", null);
398
389
  __decorate([
399
390
  test()
400
391
  ], FakeDecoratorTest, "getPersonThrowsWithoutPersonId", null);
@@ -28,7 +28,6 @@ export default class ViewFixtureTest extends AbstractSpruceFixtureTest {
28
28
  protected static canGetAuthenticatorInstance(): void;
29
29
  protected static activeRecordThrowsByDefault(): void;
30
30
  protected static activeRecordThrowReset(): void;
31
- protected static patchesFormsToThrow(): Promise<void>;
32
31
  protected static loggingInWithViewFixtureSetsProxyTokenForSkill(): Promise<void>;
33
32
  protected static proxyGeneratorIsResetWhenDifferentPersonLogsIn(): Promise<void>;
34
33
  protected static sameProxyAcrossFixturesWithSameNumber(): Promise<void>;
@@ -13,7 +13,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
13
13
  step((generator = generator.apply(thisArg, _arguments || [])).next());
14
14
  });
15
15
  };
16
- import { AbstractSkillViewController, ActiveRecordListViewController, AuthenticatorImpl, buildForm, formAssert, SwipeViewControllerImpl, vcAssert, } from '@sprucelabs/heartwood-view-controllers';
16
+ import { AbstractSkillViewController, ActiveRecordListViewController, AuthenticatorImpl, formAssert, SwipeViewControllerImpl, vcAssert, } from '@sprucelabs/heartwood-view-controllers';
17
17
  import { formatPhoneNumber } from '@sprucelabs/schema';
18
18
  import { eventResponseUtil } from '@sprucelabs/spruce-event-utils';
19
19
  import { assert, test } from '@sprucelabs/test-utils';
@@ -322,19 +322,6 @@ let ViewFixtureTest = class ViewFixtureTest extends AbstractSpruceFixtureTest {
322
322
  //@ts-ignore
323
323
  assert.isTrue(ActiveRecordListViewController.shouldThrowOnResponseError);
324
324
  }
325
- static patchesFormsToThrow() {
326
- return __awaiter(this, void 0, void 0, function* () {
327
- const viewFixture = this.Fixture('view', {
328
- controllerMap: {},
329
- });
330
- const formVc = viewFixture.Controller('form', buildForm({
331
- id: 'test',
332
- schema: { id: 'test', fields: {} },
333
- sections: [],
334
- }));
335
- yield assert.doesThrowAsync(() => formVc.submit());
336
- });
337
- }
338
325
  static loggingInWithViewFixtureSetsProxyTokenForSkill() {
339
326
  return __awaiter(this, void 0, void 0, function* () {
340
327
  const { client, token, generator } = yield this.loginAndGetProxy();
@@ -627,9 +614,6 @@ __decorate([
627
614
  __decorate([
628
615
  test()
629
616
  ], ViewFixtureTest, "activeRecordThrowReset", null);
630
- __decorate([
631
- test.skip()
632
- ], ViewFixtureTest, "patchesFormsToThrow", null);
633
617
  __decorate([
634
618
  test()
635
619
  ], ViewFixtureTest, "loggingInWithViewFixtureSetsProxyTokenForSkill", null);
@@ -6,6 +6,7 @@ import { FixtureConstructorOptionsMap, FixtureName } from '../types/fixture.type
6
6
  import LocationFixture from './fixtures/LocationFixture';
7
7
  import MercuryFixture from './fixtures/MercuryFixture';
8
8
  import OrganizationFixture from './fixtures/OrganizationFixture';
9
+ import PermissionFixture from './fixtures/PermissionFixture';
9
10
  import PersonFixture from './fixtures/PersonFixture';
10
11
  import RoleFixture from './fixtures/RoleFixture';
11
12
  import SeedFixture from './fixtures/SeedFixture';
@@ -32,6 +33,8 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
32
33
  static cwd: string;
33
34
  static get views(): ViewFixture;
34
35
  static set views(fixture: ViewFixture | undefined);
36
+ static get permissions(): PermissionFixture;
37
+ static set permissions(fixture: PermissionFixture | undefined);
35
38
  static get roles(): RoleFixture;
36
39
  static set roles(fixture: RoleFixture | undefined);
37
40
  static get locations(): LocationFixture;
@@ -60,6 +63,7 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
60
63
  private static _mercury?;
61
64
  private static _stores?;
62
65
  private static _database?;
66
+ private static _permissions?;
63
67
  protected static beforeAll(): Promise<void>;
64
68
  protected static beforeEach(): Promise<void>;
65
69
  private static clearLocalFixtures;
@@ -46,6 +46,15 @@ export default class AbstractSpruceFixtureTest extends AbstractSkillTest {
46
46
  static set views(fixture) {
47
47
  this._views = fixture;
48
48
  }
49
+ static get permissions() {
50
+ if (!this._permissions) {
51
+ this._permissions = this.Fixture('permission');
52
+ }
53
+ return this._permissions;
54
+ }
55
+ static set permissions(fixture) {
56
+ this._permissions = fixture;
57
+ }
49
58
  static get roles() {
50
59
  if (!this._roles) {
51
60
  this._roles = this.Fixture('role');
@@ -104,6 +104,9 @@ export default class FixtureFactory {
104
104
  people: this.Fixture('person'),
105
105
  });
106
106
  break;
107
+ case 'permission':
108
+ fixture = new PermissionFixture();
109
+ break;
107
110
  case 'view': {
108
111
  if (!this.namespace) {
109
112
  throw new Error('You need to be in a registered skill to load view controllers.');
@@ -1,3 +1,6 @@
1
+ import FakeAuthorizer from '../FakeAuthorizer';
1
2
  export default class PermissionFixture {
2
3
  static beforeEach(): void;
4
+ getAuthorizer(): FakeAuthorizer;
5
+ getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
3
6
  }
@@ -1,5 +1,13 @@
1
+ import { AuthenticatorImpl } from '@sprucelabs/heartwood-view-controllers';
2
+ import FakeAuthorizer from '../FakeAuthorizer.js';
1
3
  export default class PermissionFixture {
2
4
  static beforeEach() {
3
5
  process.env.SHOULD_REGISTER_PERMISSIONS = 'false';
4
6
  }
7
+ getAuthorizer() {
8
+ return FakeAuthorizer.getInstance();
9
+ }
10
+ getAuthenticator() {
11
+ return AuthenticatorImpl.getInstance();
12
+ }
5
13
  }
@@ -59,7 +59,13 @@ export default class ViewFixture {
59
59
  getScope(): SpyScope;
60
60
  getLocale(): Locale;
61
61
  getRouter(): TestRouter;
62
+ /**
63
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
64
+ */
62
65
  getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
66
+ /**
67
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
68
+ */
63
69
  getAuthorizer(): FakeAuthorizer;
64
70
  getProxyTokenGenerator(): TokenGenerator | undefined;
65
71
  setProxyTokenGenerator(cb: TokenGenerator): void;
@@ -225,9 +225,15 @@ export default class ViewFixture {
225
225
  });
226
226
  return TestRouter.getInstance();
227
227
  }
228
+ /**
229
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
230
+ */
228
231
  getAuthenticator() {
229
232
  return AuthenticatorImpl.getInstance();
230
233
  }
234
+ /**
235
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
236
+ */
231
237
  getAuthorizer() {
232
238
  return FakeAuthorizer.getInstance();
233
239
  }
@@ -5,6 +5,7 @@ import FakeSkillViewController from '../tests/Fake.svc';
5
5
  import LocationFixture from '../tests/fixtures/LocationFixture';
6
6
  import MercuryFixture from '../tests/fixtures/MercuryFixture';
7
7
  import OrganizationFixture from '../tests/fixtures/OrganizationFixture';
8
+ import PermissionFixture from '../tests/fixtures/PermissionFixture';
8
9
  import PersonFixture from '../tests/fixtures/PersonFixture';
9
10
  import RoleFixture from '../tests/fixtures/RoleFixture';
10
11
  import SeedFixture from '../tests/fixtures/SeedFixture';
@@ -27,6 +28,7 @@ export interface FixtureClassMap {
27
28
  location: typeof LocationFixture;
28
29
  role: typeof RoleFixture;
29
30
  seed: typeof SeedFixture;
31
+ permission: typeof PermissionFixture;
30
32
  }
31
33
  export type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
34
  export type FixtureMap = {
@@ -6,6 +6,7 @@ import { FixtureConstructorOptionsMap, FixtureName } from '../types/fixture.type
6
6
  import LocationFixture from './fixtures/LocationFixture';
7
7
  import MercuryFixture from './fixtures/MercuryFixture';
8
8
  import OrganizationFixture from './fixtures/OrganizationFixture';
9
+ import PermissionFixture from './fixtures/PermissionFixture';
9
10
  import PersonFixture from './fixtures/PersonFixture';
10
11
  import RoleFixture from './fixtures/RoleFixture';
11
12
  import SeedFixture from './fixtures/SeedFixture';
@@ -32,6 +33,8 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
32
33
  static cwd: string;
33
34
  static get views(): ViewFixture;
34
35
  static set views(fixture: ViewFixture | undefined);
36
+ static get permissions(): PermissionFixture;
37
+ static set permissions(fixture: PermissionFixture | undefined);
35
38
  static get roles(): RoleFixture;
36
39
  static set roles(fixture: RoleFixture | undefined);
37
40
  static get locations(): LocationFixture;
@@ -60,6 +63,7 @@ export default abstract class AbstractSpruceFixtureTest extends AbstractSkillTes
60
63
  private static _mercury?;
61
64
  private static _stores?;
62
65
  private static _database?;
66
+ private static _permissions?;
63
67
  protected static beforeAll(): Promise<void>;
64
68
  protected static beforeEach(): Promise<void>;
65
69
  private static clearLocalFixtures;
@@ -42,6 +42,15 @@ class AbstractSpruceFixtureTest extends spruce_skill_booter_1.AbstractSkillTest
42
42
  static set views(fixture) {
43
43
  this._views = fixture;
44
44
  }
45
+ static get permissions() {
46
+ if (!this._permissions) {
47
+ this._permissions = this.Fixture('permission');
48
+ }
49
+ return this._permissions;
50
+ }
51
+ static set permissions(fixture) {
52
+ this._permissions = fixture;
53
+ }
45
54
  static get roles() {
46
55
  if (!this._roles) {
47
56
  this._roles = this.Fixture('role');
@@ -100,6 +100,9 @@ class FixtureFactory {
100
100
  people: this.Fixture('person'),
101
101
  });
102
102
  break;
103
+ case 'permission':
104
+ fixture = new PermissionFixture_1.default();
105
+ break;
103
106
  case 'view': {
104
107
  if (!this.namespace) {
105
108
  throw new Error('You need to be in a registered skill to load view controllers.');
@@ -1,3 +1,6 @@
1
+ import FakeAuthorizer from '../FakeAuthorizer';
1
2
  export default class PermissionFixture {
2
3
  static beforeEach(): void;
4
+ getAuthorizer(): FakeAuthorizer;
5
+ getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
3
6
  }
@@ -1,8 +1,19 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
7
+ const FakeAuthorizer_1 = __importDefault(require("../FakeAuthorizer"));
3
8
  class PermissionFixture {
4
9
  static beforeEach() {
5
10
  process.env.SHOULD_REGISTER_PERMISSIONS = 'false';
6
11
  }
12
+ getAuthorizer() {
13
+ return FakeAuthorizer_1.default.getInstance();
14
+ }
15
+ getAuthenticator() {
16
+ return heartwood_view_controllers_1.AuthenticatorImpl.getInstance();
17
+ }
7
18
  }
8
19
  exports.default = PermissionFixture;
@@ -59,7 +59,13 @@ export default class ViewFixture {
59
59
  getScope(): SpyScope;
60
60
  getLocale(): Locale;
61
61
  getRouter(): TestRouter;
62
+ /**
63
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
64
+ */
62
65
  getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
66
+ /**
67
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
68
+ */
63
69
  getAuthorizer(): FakeAuthorizer;
64
70
  getProxyTokenGenerator(): TokenGenerator | undefined;
65
71
  setProxyTokenGenerator(cb: TokenGenerator): void;
@@ -213,9 +213,15 @@ class ViewFixture {
213
213
  });
214
214
  return TestRouter_1.default.getInstance();
215
215
  }
216
+ /**
217
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
218
+ */
216
219
  getAuthenticator() {
217
220
  return heartwood_view_controllers_1.AuthenticatorImpl.getInstance();
218
221
  }
222
+ /**
223
+ * @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
224
+ */
219
225
  getAuthorizer() {
220
226
  return FakeAuthorizer_1.default.getInstance();
221
227
  }
@@ -5,6 +5,7 @@ import FakeSkillViewController from '../tests/Fake.svc';
5
5
  import LocationFixture from '../tests/fixtures/LocationFixture';
6
6
  import MercuryFixture from '../tests/fixtures/MercuryFixture';
7
7
  import OrganizationFixture from '../tests/fixtures/OrganizationFixture';
8
+ import PermissionFixture from '../tests/fixtures/PermissionFixture';
8
9
  import PersonFixture from '../tests/fixtures/PersonFixture';
9
10
  import RoleFixture from '../tests/fixtures/RoleFixture';
10
11
  import SeedFixture from '../tests/fixtures/SeedFixture';
@@ -27,6 +28,7 @@ export interface FixtureClassMap {
27
28
  location: typeof LocationFixture;
28
29
  role: typeof RoleFixture;
29
30
  seed: typeof SeedFixture;
31
+ permission: typeof PermissionFixture;
30
32
  }
31
33
  export type RoleBase = NonNullable<SpruceSchemas.Spruce.v2020_07_22.Role['base']>;
32
34
  export type FixtureMap = {
package/package.json CHANGED
@@ -13,7 +13,7 @@
13
13
  "@sprucelabs/spruce-test-fixtures"
14
14
  ]
15
15
  },
16
- "version": "52.4.6",
16
+ "version": "52.5.0",
17
17
  "files": [
18
18
  "build/**/*",
19
19
  "!build/__tests__",
@@ -71,7 +71,7 @@
71
71
  "@sprucelabs/schema": "^28.5.85",
72
72
  "@sprucelabs/spruce-core-schemas": "^35.1.90",
73
73
  "@sprucelabs/spruce-event-utils": "^30.0.20",
74
- "@sprucelabs/spruce-skill-booter": "^52.4.6",
74
+ "@sprucelabs/spruce-skill-booter": "^52.5.0",
75
75
  "@sprucelabs/spruce-skill-utils": "^28.1.15",
76
76
  "@sprucelabs/test-utils": "^3.2.73",
77
77
  "dotenv": "^16.0.3",
@@ -131,5 +131,5 @@
131
131
  ]
132
132
  ]
133
133
  },
134
- "gitHead": "73a9e138b4ccfd3c4502817e7c74ccdcbf256461"
134
+ "gitHead": "be1e8037adffbee0e345302c43702eb294ae4eee"
135
135
  }