@sprucelabs/spruce-test-fixtures 52.5.4 → 52.5.6
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/{PermissionFixture.test.d.ts → permissions/FakeAuthorizer.test.d.ts} +2 -2
- package/build/__tests__/behavioral/{PermissionFixture.test.js → permissions/FakeAuthorizer.test.js} +9 -9
- package/build/__tests__/behavioral/permissions/PermissionFixture.test.d.ts +5 -0
- package/build/__tests__/behavioral/permissions/{TestingWithPermissions.test.js → PermissionFixture.test.js} +14 -5
- package/build/esm/__tests__/behavioral/{PermissionFixture.test.d.ts → permissions/FakeAuthorizer.test.d.ts} +2 -2
- package/build/esm/__tests__/behavioral/{PermissionFixture.test.js → permissions/FakeAuthorizer.test.js} +9 -9
- package/build/esm/__tests__/behavioral/permissions/PermissionFixture.test.d.ts +5 -0
- package/build/esm/__tests__/behavioral/permissions/{TestingWithPermissions.test.js → PermissionFixture.test.js} +16 -5
- package/build/esm/tests/FakeAuthorizer.d.ts +0 -3
- package/build/esm/tests/FakeAuthorizer.js +1 -10
- package/build/esm/tests/fixtures/FixtureFactory.js +2 -2
- package/build/esm/tests/fixtures/PermissionFixture.d.ts +3 -0
- package/build/esm/tests/fixtures/PermissionFixture.js +8 -1
- package/build/esm/tests/fixtures/ViewFixture.d.ts +4 -2
- package/build/esm/tests/fixtures/ViewFixture.js +5 -5
- package/build/esm/tests/routers/TestRouter.d.ts +4 -1
- package/build/esm/tests/routers/TestRouter.js +4 -2
- package/build/tests/FakeAuthorizer.d.ts +0 -3
- package/build/tests/FakeAuthorizer.js +1 -10
- package/build/tests/fixtures/FixtureFactory.js +2 -2
- package/build/tests/fixtures/PermissionFixture.d.ts +3 -0
- package/build/tests/fixtures/PermissionFixture.js +8 -1
- package/build/tests/fixtures/ViewFixture.d.ts +4 -2
- package/build/tests/fixtures/ViewFixture.js +5 -5
- package/build/tests/routers/TestRouter.d.ts +4 -1
- package/build/tests/routers/TestRouter.js +4 -2
- package/package.json +5 -4
- package/build/__tests__/behavioral/permissions/TestingWithPermissions.test.d.ts +0 -4
- package/build/esm/__tests__/behavioral/permissions/TestingWithPermissions.test.d.ts +0 -4
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import AbstractSpruceFixtureTest from '
|
|
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>;
|
|
5
5
|
protected static canCreateCheckingPermissions(): Promise<void>;
|
|
6
6
|
protected static sharesInstances(): Promise<void>;
|
|
7
|
-
protected static
|
|
7
|
+
protected static permsFixtureResetsInstance(): Promise<void>;
|
|
8
8
|
protected static throwsWhenMissingOnCan(): Promise<void>;
|
|
9
9
|
protected static throwsWhenNotSettingResponse(): Promise<void>;
|
|
10
10
|
protected static throwsWhenContractIdNotFaked(): Promise<void>;
|
package/build/__tests__/behavioral/{PermissionFixture.test.js → permissions/FakeAuthorizer.test.js}
RENAMED
|
@@ -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("
|
|
15
|
-
const FakeAuthorizer_1 = __importDefault(require("
|
|
16
|
-
const
|
|
14
|
+
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
|
|
15
|
+
const FakeAuthorizer_1 = __importDefault(require("../../../tests/FakeAuthorizer"));
|
|
16
|
+
const PermissionFixture_1 = __importDefault(require("../../../tests/fixtures/PermissionFixture"));
|
|
17
17
|
class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
|
|
18
18
|
static async beforeEach() {
|
|
19
19
|
await super.beforeEach();
|
|
@@ -25,9 +25,9 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
|
|
|
25
25
|
static async sharesInstances() {
|
|
26
26
|
test_utils_1.assert.isEqual(this.instance, this.instance);
|
|
27
27
|
}
|
|
28
|
-
static async
|
|
28
|
+
static async permsFixtureResetsInstance() {
|
|
29
29
|
const instance = this.instance;
|
|
30
|
-
|
|
30
|
+
PermissionFixture_1.default.beforeEach();
|
|
31
31
|
test_utils_1.assert.isNotEqual(this.instance, instance);
|
|
32
32
|
}
|
|
33
33
|
static async throwsWhenMissingOnCan() {
|
|
@@ -70,7 +70,7 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
|
|
|
70
70
|
}
|
|
71
71
|
static async fixtureAndLoadOptionsShareAuthorizer() {
|
|
72
72
|
this.setupEmptyViewFixture();
|
|
73
|
-
const auth = this.
|
|
73
|
+
const auth = this.permissions.getAuthorizer();
|
|
74
74
|
const router = this.views.getRouter();
|
|
75
75
|
test_utils_1.assert.isEqual(auth, router.buildLoadOptions().authorizer);
|
|
76
76
|
}
|
|
@@ -121,7 +121,7 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
|
|
|
121
121
|
this.contractId = (0, test_utils_2.generateId)();
|
|
122
122
|
}
|
|
123
123
|
static async assertThrowsFakeError() {
|
|
124
|
-
await test_utils_1.assert.doesThrowAsync(() => this.can(['test']), `Contract
|
|
124
|
+
await test_utils_1.assert.doesThrowAsync(() => this.can(['test']), `Contract with the id '${this.contractId}'`);
|
|
125
125
|
}
|
|
126
126
|
static fakePermissions(faked) {
|
|
127
127
|
this.instance.fakePermissions({
|
|
@@ -141,7 +141,7 @@ class CheckingPermissionsTest extends AbstractSpruceFixtureTest_1.default {
|
|
|
141
141
|
});
|
|
142
142
|
}
|
|
143
143
|
static get instance() {
|
|
144
|
-
return
|
|
144
|
+
return this.permissions.getAuthorizer();
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
__decorate([
|
|
@@ -152,7 +152,7 @@ __decorate([
|
|
|
152
152
|
], CheckingPermissionsTest, "sharesInstances", null);
|
|
153
153
|
__decorate([
|
|
154
154
|
(0, test_utils_1.test)()
|
|
155
|
-
], CheckingPermissionsTest, "
|
|
155
|
+
], CheckingPermissionsTest, "permsFixtureResetsInstance", null);
|
|
156
156
|
__decorate([
|
|
157
157
|
(0, test_utils_1.test)()
|
|
158
158
|
], CheckingPermissionsTest, "throwsWhenMissingOnCan", null);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
2
|
+
export default class PermissionFixtureTest extends AbstractSpruceFixtureTest {
|
|
3
|
+
protected static disablesPermissionsAtStart(): Promise<void>;
|
|
4
|
+
protected static permissionFixtureShouldUseSharedInstance(): Promise<void>;
|
|
5
|
+
}
|
|
@@ -9,18 +9,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
9
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const spruce_permission_utils_1 = require("@sprucelabs/spruce-permission-utils");
|
|
12
13
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
13
14
|
const AbstractSpruceFixtureTest_1 = __importDefault(require("../../../tests/AbstractSpruceFixtureTest"));
|
|
14
15
|
const fake_1 = __importDefault(require("../../../tests/decorators/fake"));
|
|
15
|
-
let
|
|
16
|
+
let PermissionFixtureTest = class PermissionFixtureTest extends AbstractSpruceFixtureTest_1.default {
|
|
16
17
|
static async disablesPermissionsAtStart() {
|
|
17
18
|
test_utils_1.assert.isEqual(process.env.SHOULD_REGISTER_PERMISSIONS, 'false');
|
|
18
19
|
}
|
|
20
|
+
static async permissionFixtureShouldUseSharedInstance() {
|
|
21
|
+
const actual = this.permissions.getAuthorizer();
|
|
22
|
+
const expected = spruce_permission_utils_1.AuthorizerFactory.getInstance();
|
|
23
|
+
test_utils_1.assert.isEqual(actual, expected);
|
|
24
|
+
}
|
|
19
25
|
};
|
|
20
26
|
__decorate([
|
|
21
27
|
(0, test_utils_1.test)()
|
|
22
|
-
],
|
|
23
|
-
|
|
28
|
+
], PermissionFixtureTest, "disablesPermissionsAtStart", null);
|
|
29
|
+
__decorate([
|
|
30
|
+
(0, test_utils_1.test)()
|
|
31
|
+
], PermissionFixtureTest, "permissionFixtureShouldUseSharedInstance", null);
|
|
32
|
+
PermissionFixtureTest = __decorate([
|
|
24
33
|
fake_1.default.login()
|
|
25
|
-
],
|
|
26
|
-
exports.default =
|
|
34
|
+
], PermissionFixtureTest);
|
|
35
|
+
exports.default = PermissionFixtureTest;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import AbstractSpruceFixtureTest from '
|
|
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>;
|
|
5
5
|
protected static canCreateCheckingPermissions(): Promise<void>;
|
|
6
6
|
protected static sharesInstances(): Promise<void>;
|
|
7
|
-
protected static
|
|
7
|
+
protected static permsFixtureResetsInstance(): Promise<void>;
|
|
8
8
|
protected static throwsWhenMissingOnCan(): Promise<void>;
|
|
9
9
|
protected static throwsWhenNotSettingResponse(): Promise<void>;
|
|
10
10
|
protected static throwsWhenContractIdNotFaked(): Promise<void>;
|
|
@@ -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 '
|
|
19
|
-
import FakeAuthorizer from '
|
|
20
|
-
import
|
|
18
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
19
|
+
import FakeAuthorizer from '../../../tests/FakeAuthorizer.js';
|
|
20
|
+
import PermissionFixture from '../../../tests/fixtures/PermissionFixture.js';
|
|
21
21
|
export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
22
22
|
static beforeEach() {
|
|
23
23
|
const _super = Object.create(null, {
|
|
@@ -38,10 +38,10 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
|
38
38
|
assert.isEqual(this.instance, this.instance);
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
static
|
|
41
|
+
static permsFixtureResetsInstance() {
|
|
42
42
|
return __awaiter(this, void 0, void 0, function* () {
|
|
43
43
|
const instance = this.instance;
|
|
44
|
-
|
|
44
|
+
PermissionFixture.beforeEach();
|
|
45
45
|
assert.isNotEqual(this.instance, instance);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
@@ -100,7 +100,7 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
|
100
100
|
static fixtureAndLoadOptionsShareAuthorizer() {
|
|
101
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
102
|
this.setupEmptyViewFixture();
|
|
103
|
-
const auth = this.
|
|
103
|
+
const auth = this.permissions.getAuthorizer();
|
|
104
104
|
const router = this.views.getRouter();
|
|
105
105
|
assert.isEqual(auth, router.buildLoadOptions().authorizer);
|
|
106
106
|
});
|
|
@@ -165,7 +165,7 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
|
165
165
|
}
|
|
166
166
|
static assertThrowsFakeError() {
|
|
167
167
|
return __awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
yield assert.doesThrowAsync(() => this.can(['test']), `Contract
|
|
168
|
+
yield assert.doesThrowAsync(() => this.can(['test']), `Contract with the id '${this.contractId}'`);
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
static fakePermissions(faked) {
|
|
@@ -186,7 +186,7 @@ export default class CheckingPermissionsTest extends AbstractSpruceFixtureTest {
|
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
static get instance() {
|
|
189
|
-
return
|
|
189
|
+
return this.permissions.getAuthorizer();
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
192
|
__decorate([
|
|
@@ -197,7 +197,7 @@ __decorate([
|
|
|
197
197
|
], CheckingPermissionsTest, "sharesInstances", null);
|
|
198
198
|
__decorate([
|
|
199
199
|
test()
|
|
200
|
-
], CheckingPermissionsTest, "
|
|
200
|
+
], CheckingPermissionsTest, "permsFixtureResetsInstance", null);
|
|
201
201
|
__decorate([
|
|
202
202
|
test()
|
|
203
203
|
], CheckingPermissionsTest, "throwsWhenMissingOnCan", null);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest';
|
|
2
|
+
export default class PermissionFixtureTest extends AbstractSpruceFixtureTest {
|
|
3
|
+
protected static disablesPermissionsAtStart(): Promise<void>;
|
|
4
|
+
protected static permissionFixtureShouldUseSharedInstance(): Promise<void>;
|
|
5
|
+
}
|
|
@@ -13,20 +13,31 @@ 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 { AuthorizerFactory } from '@sprucelabs/spruce-permission-utils';
|
|
16
17
|
import { test, assert } from '@sprucelabs/test-utils';
|
|
17
18
|
import AbstractSpruceFixtureTest from '../../../tests/AbstractSpruceFixtureTest.js';
|
|
18
19
|
import fake from '../../../tests/decorators/fake.js';
|
|
19
|
-
let
|
|
20
|
+
let PermissionFixtureTest = class PermissionFixtureTest extends AbstractSpruceFixtureTest {
|
|
20
21
|
static disablesPermissionsAtStart() {
|
|
21
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
23
|
assert.isEqual(process.env.SHOULD_REGISTER_PERMISSIONS, 'false');
|
|
23
24
|
});
|
|
24
25
|
}
|
|
26
|
+
static permissionFixtureShouldUseSharedInstance() {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
const actual = this.permissions.getAuthorizer();
|
|
29
|
+
const expected = AuthorizerFactory.getInstance();
|
|
30
|
+
assert.isEqual(actual, expected);
|
|
31
|
+
});
|
|
32
|
+
}
|
|
25
33
|
};
|
|
26
34
|
__decorate([
|
|
27
35
|
test()
|
|
28
|
-
],
|
|
29
|
-
|
|
36
|
+
], PermissionFixtureTest, "disablesPermissionsAtStart", null);
|
|
37
|
+
__decorate([
|
|
38
|
+
test()
|
|
39
|
+
], PermissionFixtureTest, "permissionFixtureShouldUseSharedInstance", null);
|
|
40
|
+
PermissionFixtureTest = __decorate([
|
|
30
41
|
fake.login()
|
|
31
|
-
],
|
|
32
|
-
export default
|
|
42
|
+
], PermissionFixtureTest);
|
|
43
|
+
export default PermissionFixtureTest;
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Authorizer, AuthorizerCanOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { PermissionContractId, PermissionId } from '@sprucelabs/mercury-types';
|
|
3
3
|
export default class FakeAuthorizer implements Authorizer {
|
|
4
|
-
private static instance?;
|
|
5
4
|
private fakedContracts;
|
|
6
|
-
static getInstance(): FakeAuthorizer;
|
|
7
|
-
static reset(): void;
|
|
8
5
|
fakePermissions<ContractId extends PermissionContractId = PermissionContractId>(options: FakeOptions<ContractId>): void;
|
|
9
6
|
can<ContractId extends PermissionContractId, Ids extends PermissionId<ContractId>>(options: AuthorizerCanOptions<ContractId, Ids>): Promise<Record<Ids, boolean>>;
|
|
10
7
|
private assertValidPermission;
|
|
@@ -13,15 +13,6 @@ export default class FakeAuthorizer {
|
|
|
13
13
|
constructor() {
|
|
14
14
|
this.fakedContracts = [];
|
|
15
15
|
}
|
|
16
|
-
static getInstance() {
|
|
17
|
-
if (!this.instance) {
|
|
18
|
-
this.instance = new this();
|
|
19
|
-
}
|
|
20
|
-
return this.instance;
|
|
21
|
-
}
|
|
22
|
-
static reset() {
|
|
23
|
-
this.instance = undefined;
|
|
24
|
-
}
|
|
25
16
|
fakePermissions(options) {
|
|
26
17
|
this.fakedContracts.unshift(options);
|
|
27
18
|
}
|
|
@@ -48,7 +39,7 @@ Valid permissions on this contract are:
|
|
|
48
39
|
${faked.permissions.map((p) => p.id).join('\n')}`);
|
|
49
40
|
}
|
|
50
41
|
assertValidContractId(faked, contractId) {
|
|
51
|
-
assert.isTruthy(faked, `Contract
|
|
42
|
+
assert.isTruthy(faked, `Contract with the id '${contractId}' not found! You need to tell the authorizer how to respond. Try 'this.views.getAuthorizer().fakePermissions(...)'
|
|
52
43
|
|
|
53
44
|
Valid contracts are:
|
|
54
45
|
|
|
@@ -105,7 +105,7 @@ export default class FixtureFactory {
|
|
|
105
105
|
});
|
|
106
106
|
break;
|
|
107
107
|
case 'permission':
|
|
108
|
-
fixture = new PermissionFixture();
|
|
108
|
+
fixture = new PermissionFixture(mercuryFixture);
|
|
109
109
|
break;
|
|
110
110
|
case 'view': {
|
|
111
111
|
if (!this.namespace) {
|
|
@@ -113,7 +113,7 @@ export default class FixtureFactory {
|
|
|
113
113
|
}
|
|
114
114
|
fixture = new ViewFixture(Object.assign({
|
|
115
115
|
//@ts-ignore
|
|
116
|
-
people: (_e = options === null || options === void 0 ? void 0 : options.personFixture) !== null && _e !== void 0 ? _e : this.Fixture('person'), connectToApi: mercuryFixture.getConnectFactory(), fixtureFactory: this, namespace: this.namespace, proxyDecorator: ClientProxyDecorator.getInstance(), cwd: this.cwd }, options));
|
|
116
|
+
people: (_e = options === null || options === void 0 ? void 0 : options.personFixture) !== null && _e !== void 0 ? _e : this.Fixture('person'), connectToApi: mercuryFixture.getConnectFactory(), fixtureFactory: this, namespace: this.namespace, proxyDecorator: ClientProxyDecorator.getInstance(), cwd: this.cwd, permissions: this.Fixture('permission') }, options));
|
|
117
117
|
break;
|
|
118
118
|
}
|
|
119
119
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import FakeAuthorizer from '../FakeAuthorizer';
|
|
2
|
+
import MercuryFixture from './MercuryFixture';
|
|
2
3
|
export default class PermissionFixture {
|
|
4
|
+
private connectToApi;
|
|
5
|
+
constructor(mercury: MercuryFixture);
|
|
3
6
|
static beforeEach(): void;
|
|
4
7
|
getAuthorizer(): FakeAuthorizer;
|
|
5
8
|
getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { AuthenticatorImpl } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { AuthorizerFactory } from '@sprucelabs/spruce-permission-utils';
|
|
2
3
|
import FakeAuthorizer from '../FakeAuthorizer.js';
|
|
3
4
|
export default class PermissionFixture {
|
|
5
|
+
constructor(mercury) {
|
|
6
|
+
this.connectToApi = mercury.getConnectFactory();
|
|
7
|
+
AuthorizerFactory.setConnectToApi(this.connectToApi);
|
|
8
|
+
}
|
|
4
9
|
static beforeEach() {
|
|
5
10
|
process.env.SHOULD_REGISTER_PERMISSIONS = 'false';
|
|
11
|
+
AuthorizerFactory.reset();
|
|
12
|
+
AuthorizerFactory.setClass(FakeAuthorizer);
|
|
6
13
|
}
|
|
7
14
|
getAuthorizer() {
|
|
8
|
-
return
|
|
15
|
+
return AuthorizerFactory.getInstance();
|
|
9
16
|
}
|
|
10
17
|
getAuthenticator() {
|
|
11
18
|
return AuthenticatorImpl.getInstance();
|
|
@@ -6,9 +6,9 @@ import { ClientProxyDecorator } from '../..';
|
|
|
6
6
|
import { TokenGenerator } from '../../ClientProxyDecorator';
|
|
7
7
|
import { TestConnectFactory } from '../../types/fixture.types';
|
|
8
8
|
import { ArgsFromSvc } from '../../types/view.types';
|
|
9
|
-
import FakeAuthorizer from '../FakeAuthorizer';
|
|
10
9
|
import TestRouter from '../routers/TestRouter';
|
|
11
10
|
import FixtureFactory from './FixtureFactory';
|
|
11
|
+
import PermissionFixture from './PermissionFixture';
|
|
12
12
|
import PersonFixture from './PersonFixture';
|
|
13
13
|
import SpyScope from './SpyScope';
|
|
14
14
|
type Factory = TestConnectFactory;
|
|
@@ -29,6 +29,7 @@ export default class ViewFixture {
|
|
|
29
29
|
private locations;
|
|
30
30
|
private proxyDecorator;
|
|
31
31
|
private locale;
|
|
32
|
+
private permissions;
|
|
32
33
|
static lockProxyCacheForPerson(id: any): void;
|
|
33
34
|
static setShouldAutomaticallyResetAuth(shouldReset: false): void;
|
|
34
35
|
constructor(options: {
|
|
@@ -40,6 +41,7 @@ export default class ViewFixture {
|
|
|
40
41
|
controllerMap?: Record<string, any>;
|
|
41
42
|
namespace: string;
|
|
42
43
|
proxyDecorator: ClientProxyDecorator;
|
|
44
|
+
permissions: PermissionFixture;
|
|
43
45
|
});
|
|
44
46
|
getFactory(): ViewControllerFactory;
|
|
45
47
|
getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
|
|
@@ -66,7 +68,7 @@ export default class ViewFixture {
|
|
|
66
68
|
/**
|
|
67
69
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
68
70
|
*/
|
|
69
|
-
getAuthorizer(): FakeAuthorizer;
|
|
71
|
+
getAuthorizer(): import("../FakeAuthorizer").default;
|
|
70
72
|
getProxyTokenGenerator(): TokenGenerator | undefined;
|
|
71
73
|
setProxyTokenGenerator(cb: TokenGenerator): void;
|
|
72
74
|
loginAsDemoPerson(phone?: string): Promise<{
|
|
@@ -16,7 +16,6 @@ import SpruceError from '../../errors/SpruceError.js';
|
|
|
16
16
|
import spyMapUtil from '../../utilities/SpyMapUtil.js';
|
|
17
17
|
import vcDiskUtil from '../../utilities/vcDisk.utility.js';
|
|
18
18
|
import FakeSkillViewController from '../Fake.svc.js';
|
|
19
|
-
import FakeAuthorizer from '../FakeAuthorizer.js';
|
|
20
19
|
import TestRouter from '../routers/TestRouter.js';
|
|
21
20
|
import SpyScope from './SpyScope.js';
|
|
22
21
|
export default class ViewFixture {
|
|
@@ -38,6 +37,7 @@ export default class ViewFixture {
|
|
|
38
37
|
this.orgs = options.fixtureFactory.Fixture('organization', {
|
|
39
38
|
people: this.people,
|
|
40
39
|
});
|
|
40
|
+
this.permissions = options.permissions;
|
|
41
41
|
this.locale = new LocaleImpl();
|
|
42
42
|
this.locations = options.fixtureFactory.Fixture('location', {
|
|
43
43
|
people: this.people,
|
|
@@ -154,7 +154,6 @@ export default class ViewFixture {
|
|
|
154
154
|
};
|
|
155
155
|
}
|
|
156
156
|
TestRouter.reset();
|
|
157
|
-
FakeAuthorizer.reset();
|
|
158
157
|
ViewFixture.resetMaps();
|
|
159
158
|
ActiveRecordCardViewController.setShouldThrowOnResponseError(true);
|
|
160
159
|
process.env.SHOULD_REGISTER_VIEWS = 'false';
|
|
@@ -222,6 +221,7 @@ export default class ViewFixture {
|
|
|
222
221
|
vcFactory: this.getFactory(),
|
|
223
222
|
scope: this.getScope(),
|
|
224
223
|
locale: this.getLocale(),
|
|
224
|
+
authorizer: this.permissions.getAuthorizer(),
|
|
225
225
|
});
|
|
226
226
|
return TestRouter.getInstance();
|
|
227
227
|
}
|
|
@@ -229,13 +229,13 @@ export default class ViewFixture {
|
|
|
229
229
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
230
230
|
*/
|
|
231
231
|
getAuthenticator() {
|
|
232
|
-
return
|
|
232
|
+
return this.permissions.getAuthenticator();
|
|
233
233
|
}
|
|
234
234
|
/**
|
|
235
235
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
236
236
|
*/
|
|
237
237
|
getAuthorizer() {
|
|
238
|
-
return
|
|
238
|
+
return this.permissions.getAuthorizer();
|
|
239
239
|
}
|
|
240
240
|
getProxyTokenGenerator() {
|
|
241
241
|
return this.proxyDecorator.getProxyTokenGenerator();
|
|
@@ -246,7 +246,7 @@ export default class ViewFixture {
|
|
|
246
246
|
loginAsDemoPerson(phone) {
|
|
247
247
|
return __awaiter(this, void 0, void 0, function* () {
|
|
248
248
|
const { person, token, client } = yield this.people.loginAsDemoPerson(phone);
|
|
249
|
-
this.getAuthenticator().setSessionToken(token, person);
|
|
249
|
+
this.permissions.getAuthenticator().setSessionToken(token, person);
|
|
250
250
|
this.proxyDecorator.setProxyTokenGenerator(() => __awaiter(this, void 0, void 0, function* () {
|
|
251
251
|
if (!ViewFixture.loggedInPersonProxyTokens[person.id]) {
|
|
252
252
|
const proxyToken = client.registerProxyToken();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Locale } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { Router, Scope, SkillViewController, SkillViewControllerArgs, SkillViewControllerId, SkillViewControllerLoadOptions, SkillViewControllerMap, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { Authorizer, Router, Scope, SkillViewController, SkillViewControllerArgs, SkillViewControllerId, SkillViewControllerLoadOptions, SkillViewControllerMap, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter';
|
|
4
4
|
import { MercuryEventEmitter } from '@sprucelabs/mercury-types';
|
|
5
5
|
import FakeThemeManager from '../../__tests__/support/FakeThemeManager';
|
|
@@ -23,6 +23,8 @@ export default class TestRouter extends AbstractEventEmitter<Contract> implement
|
|
|
23
23
|
private scope;
|
|
24
24
|
private locale;
|
|
25
25
|
private readonly themes;
|
|
26
|
+
private authorizer;
|
|
27
|
+
private static authorizer;
|
|
26
28
|
static setShouldThrowWhenRedirectingToBadSvc(shouldThrow: boolean): void;
|
|
27
29
|
private constructor();
|
|
28
30
|
static setShouldLoadDestinationVc(shouldLoad: boolean): void;
|
|
@@ -32,6 +34,7 @@ export default class TestRouter extends AbstractEventEmitter<Contract> implement
|
|
|
32
34
|
vcFactory: ViewControllerFactory;
|
|
33
35
|
scope: Scope;
|
|
34
36
|
locale: Locale;
|
|
37
|
+
authorizer: Authorizer;
|
|
35
38
|
}): void;
|
|
36
39
|
getPresentVc(): SkillViewController<any> | undefined;
|
|
37
40
|
redirect<Id extends SkillViewControllerId>(id: Id, args?: SkillViewControllerArgs<Id>): Promise<SkillViewControllerMap[Id]>;
|
|
@@ -12,7 +12,6 @@ import { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter';
|
|
|
12
12
|
import { buildEventContract, } from '@sprucelabs/mercury-types';
|
|
13
13
|
import testRouterEmitPayloadSchema from './../../.spruce/schemas/spruceTestFixtures/v2021_07_19/testRouterEmitPayload.schema.js';
|
|
14
14
|
import FakeThemeManager from '../../__tests__/support/FakeThemeManager.js';
|
|
15
|
-
import FakeAuthorizer from '../FakeAuthorizer.js';
|
|
16
15
|
const contract = buildEventContract({
|
|
17
16
|
eventSignatures: {
|
|
18
17
|
'did-redirect': {
|
|
@@ -30,6 +29,7 @@ export default class TestRouter extends AbstractEventEmitter {
|
|
|
30
29
|
this.vcFactory = options.vcFactory;
|
|
31
30
|
this.scope = options.scope;
|
|
32
31
|
this.locale = options.locale;
|
|
32
|
+
this.authorizer = options.authorizer;
|
|
33
33
|
}
|
|
34
34
|
static setShouldLoadDestinationVc(shouldLoad) {
|
|
35
35
|
this.shouldLoadDestinationVc = shouldLoad;
|
|
@@ -40,6 +40,7 @@ export default class TestRouter extends AbstractEventEmitter {
|
|
|
40
40
|
vcFactory: this.vcFactory,
|
|
41
41
|
scope: this.scope,
|
|
42
42
|
locale: this.locale,
|
|
43
|
+
authorizer: this.authorizer,
|
|
43
44
|
});
|
|
44
45
|
routerTestPatcher.patchRedirectToThrow(this.instance);
|
|
45
46
|
}
|
|
@@ -55,6 +56,7 @@ export default class TestRouter extends AbstractEventEmitter {
|
|
|
55
56
|
this.vcFactory = options.vcFactory;
|
|
56
57
|
this.scope = options.scope;
|
|
57
58
|
this.locale = options.locale;
|
|
59
|
+
this.authorizer = options.authorizer;
|
|
58
60
|
}
|
|
59
61
|
getPresentVc() {
|
|
60
62
|
return this.presentVc;
|
|
@@ -93,7 +95,7 @@ export default class TestRouter extends AbstractEventEmitter {
|
|
|
93
95
|
authenticator: AuthenticatorImpl.getInstance(),
|
|
94
96
|
args,
|
|
95
97
|
locale: this.locale,
|
|
96
|
-
authorizer:
|
|
98
|
+
authorizer: this.authorizer,
|
|
97
99
|
scope: this.scope,
|
|
98
100
|
themes: this.themes,
|
|
99
101
|
};
|
|
@@ -1,10 +1,7 @@
|
|
|
1
1
|
import { Authorizer, AuthorizerCanOptions } from '@sprucelabs/heartwood-view-controllers';
|
|
2
2
|
import { PermissionContractId, PermissionId } from '@sprucelabs/mercury-types';
|
|
3
3
|
export default class FakeAuthorizer implements Authorizer {
|
|
4
|
-
private static instance?;
|
|
5
4
|
private fakedContracts;
|
|
6
|
-
static getInstance(): FakeAuthorizer;
|
|
7
|
-
static reset(): void;
|
|
8
5
|
fakePermissions<ContractId extends PermissionContractId = PermissionContractId>(options: FakeOptions<ContractId>): void;
|
|
9
6
|
can<ContractId extends PermissionContractId, Ids extends PermissionId<ContractId>>(options: AuthorizerCanOptions<ContractId, Ids>): Promise<Record<Ids, boolean>>;
|
|
10
7
|
private assertValidPermission;
|
|
@@ -6,15 +6,6 @@ class FakeAuthorizer {
|
|
|
6
6
|
constructor() {
|
|
7
7
|
this.fakedContracts = [];
|
|
8
8
|
}
|
|
9
|
-
static getInstance() {
|
|
10
|
-
if (!this.instance) {
|
|
11
|
-
this.instance = new this();
|
|
12
|
-
}
|
|
13
|
-
return this.instance;
|
|
14
|
-
}
|
|
15
|
-
static reset() {
|
|
16
|
-
this.instance = undefined;
|
|
17
|
-
}
|
|
18
9
|
fakePermissions(options) {
|
|
19
10
|
this.fakedContracts.unshift(options);
|
|
20
11
|
}
|
|
@@ -39,7 +30,7 @@ Valid permissions on this contract are:
|
|
|
39
30
|
${faked.permissions.map((p) => p.id).join('\n')}`);
|
|
40
31
|
}
|
|
41
32
|
assertValidContractId(faked, contractId) {
|
|
42
|
-
test_utils_1.assert.isTruthy(faked, `Contract
|
|
33
|
+
test_utils_1.assert.isTruthy(faked, `Contract with the id '${contractId}' not found! You need to tell the authorizer how to respond. Try 'this.views.getAuthorizer().fakePermissions(...)'
|
|
43
34
|
|
|
44
35
|
Valid contracts are:
|
|
45
36
|
|
|
@@ -101,7 +101,7 @@ class FixtureFactory {
|
|
|
101
101
|
});
|
|
102
102
|
break;
|
|
103
103
|
case 'permission':
|
|
104
|
-
fixture = new PermissionFixture_1.default();
|
|
104
|
+
fixture = new PermissionFixture_1.default(mercuryFixture);
|
|
105
105
|
break;
|
|
106
106
|
case 'view': {
|
|
107
107
|
if (!this.namespace) {
|
|
@@ -109,7 +109,7 @@ class FixtureFactory {
|
|
|
109
109
|
}
|
|
110
110
|
fixture = new ViewFixture_1.default(Object.assign({
|
|
111
111
|
//@ts-ignore
|
|
112
|
-
people: (_e = options === null || options === void 0 ? void 0 : options.personFixture) !== null && _e !== void 0 ? _e : this.Fixture('person'), connectToApi: mercuryFixture.getConnectFactory(), fixtureFactory: this, namespace: this.namespace, proxyDecorator: __1.ClientProxyDecorator.getInstance(), cwd: this.cwd }, options));
|
|
112
|
+
people: (_e = options === null || options === void 0 ? void 0 : options.personFixture) !== null && _e !== void 0 ? _e : this.Fixture('person'), connectToApi: mercuryFixture.getConnectFactory(), fixtureFactory: this, namespace: this.namespace, proxyDecorator: __1.ClientProxyDecorator.getInstance(), cwd: this.cwd, permissions: this.Fixture('permission') }, options));
|
|
113
113
|
break;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import FakeAuthorizer from '../FakeAuthorizer';
|
|
2
|
+
import MercuryFixture from './MercuryFixture';
|
|
2
3
|
export default class PermissionFixture {
|
|
4
|
+
private connectToApi;
|
|
5
|
+
constructor(mercury: MercuryFixture);
|
|
3
6
|
static beforeEach(): void;
|
|
4
7
|
getAuthorizer(): FakeAuthorizer;
|
|
5
8
|
getAuthenticator(): import("@sprucelabs/heartwood-view-controllers").Authenticator;
|
|
@@ -4,13 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
7
|
+
const spruce_permission_utils_1 = require("@sprucelabs/spruce-permission-utils");
|
|
7
8
|
const FakeAuthorizer_1 = __importDefault(require("../FakeAuthorizer"));
|
|
8
9
|
class PermissionFixture {
|
|
10
|
+
constructor(mercury) {
|
|
11
|
+
this.connectToApi = mercury.getConnectFactory();
|
|
12
|
+
spruce_permission_utils_1.AuthorizerFactory.setConnectToApi(this.connectToApi);
|
|
13
|
+
}
|
|
9
14
|
static beforeEach() {
|
|
10
15
|
process.env.SHOULD_REGISTER_PERMISSIONS = 'false';
|
|
16
|
+
spruce_permission_utils_1.AuthorizerFactory.reset();
|
|
17
|
+
spruce_permission_utils_1.AuthorizerFactory.setClass(FakeAuthorizer_1.default);
|
|
11
18
|
}
|
|
12
19
|
getAuthorizer() {
|
|
13
|
-
return
|
|
20
|
+
return spruce_permission_utils_1.AuthorizerFactory.getInstance();
|
|
14
21
|
}
|
|
15
22
|
getAuthenticator() {
|
|
16
23
|
return heartwood_view_controllers_1.AuthenticatorImpl.getInstance();
|
|
@@ -6,9 +6,9 @@ import { ClientProxyDecorator } from '../..';
|
|
|
6
6
|
import { TokenGenerator } from '../../ClientProxyDecorator';
|
|
7
7
|
import { TestConnectFactory } from '../../types/fixture.types';
|
|
8
8
|
import { ArgsFromSvc } from '../../types/view.types';
|
|
9
|
-
import FakeAuthorizer from '../FakeAuthorizer';
|
|
10
9
|
import TestRouter from '../routers/TestRouter';
|
|
11
10
|
import FixtureFactory from './FixtureFactory';
|
|
11
|
+
import PermissionFixture from './PermissionFixture';
|
|
12
12
|
import PersonFixture from './PersonFixture';
|
|
13
13
|
import SpyScope from './SpyScope';
|
|
14
14
|
type Factory = TestConnectFactory;
|
|
@@ -29,6 +29,7 @@ export default class ViewFixture {
|
|
|
29
29
|
private locations;
|
|
30
30
|
private proxyDecorator;
|
|
31
31
|
private locale;
|
|
32
|
+
private permissions;
|
|
32
33
|
static lockProxyCacheForPerson(id: any): void;
|
|
33
34
|
static setShouldAutomaticallyResetAuth(shouldReset: false): void;
|
|
34
35
|
constructor(options: {
|
|
@@ -40,6 +41,7 @@ export default class ViewFixture {
|
|
|
40
41
|
controllerMap?: Record<string, any>;
|
|
41
42
|
namespace: string;
|
|
42
43
|
proxyDecorator: ClientProxyDecorator;
|
|
44
|
+
permissions: PermissionFixture;
|
|
43
45
|
});
|
|
44
46
|
getFactory(): ViewControllerFactory;
|
|
45
47
|
getMaps(): import("../../utilities/SpyMapUtil").SpyMapUtil;
|
|
@@ -66,7 +68,7 @@ export default class ViewFixture {
|
|
|
66
68
|
/**
|
|
67
69
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
68
70
|
*/
|
|
69
|
-
getAuthorizer(): FakeAuthorizer;
|
|
71
|
+
getAuthorizer(): import("../FakeAuthorizer").default;
|
|
70
72
|
getProxyTokenGenerator(): TokenGenerator | undefined;
|
|
71
73
|
setProxyTokenGenerator(cb: TokenGenerator): void;
|
|
72
74
|
loginAsDemoPerson(phone?: string): Promise<{
|
|
@@ -12,7 +12,6 @@ const SpruceError_1 = __importDefault(require("../../errors/SpruceError"));
|
|
|
12
12
|
const SpyMapUtil_1 = __importDefault(require("../../utilities/SpyMapUtil"));
|
|
13
13
|
const vcDisk_utility_1 = __importDefault(require("../../utilities/vcDisk.utility"));
|
|
14
14
|
const Fake_svc_1 = __importDefault(require("../Fake.svc"));
|
|
15
|
-
const FakeAuthorizer_1 = __importDefault(require("../FakeAuthorizer"));
|
|
16
15
|
const TestRouter_1 = __importDefault(require("../routers/TestRouter"));
|
|
17
16
|
const SpyScope_1 = __importDefault(require("./SpyScope"));
|
|
18
17
|
class ViewFixture {
|
|
@@ -34,6 +33,7 @@ class ViewFixture {
|
|
|
34
33
|
this.orgs = options.fixtureFactory.Fixture('organization', {
|
|
35
34
|
people: this.people,
|
|
36
35
|
});
|
|
36
|
+
this.permissions = options.permissions;
|
|
37
37
|
this.locale = new calendar_utils_1.LocaleImpl();
|
|
38
38
|
this.locations = options.fixtureFactory.Fixture('location', {
|
|
39
39
|
people: this.people,
|
|
@@ -147,7 +147,6 @@ class ViewFixture {
|
|
|
147
147
|
};
|
|
148
148
|
}
|
|
149
149
|
TestRouter_1.default.reset();
|
|
150
|
-
FakeAuthorizer_1.default.reset();
|
|
151
150
|
ViewFixture.resetMaps();
|
|
152
151
|
heartwood_view_controllers_1.ActiveRecordCardViewController.setShouldThrowOnResponseError(true);
|
|
153
152
|
process.env.SHOULD_REGISTER_VIEWS = 'false';
|
|
@@ -210,6 +209,7 @@ class ViewFixture {
|
|
|
210
209
|
vcFactory: this.getFactory(),
|
|
211
210
|
scope: this.getScope(),
|
|
212
211
|
locale: this.getLocale(),
|
|
212
|
+
authorizer: this.permissions.getAuthorizer(),
|
|
213
213
|
});
|
|
214
214
|
return TestRouter_1.default.getInstance();
|
|
215
215
|
}
|
|
@@ -217,13 +217,13 @@ class ViewFixture {
|
|
|
217
217
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
218
218
|
*/
|
|
219
219
|
getAuthenticator() {
|
|
220
|
-
return
|
|
220
|
+
return this.permissions.getAuthenticator();
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
223
|
* @deprecated this.views.getAuthorizer() -> this.permissions.getAuthorizer()
|
|
224
224
|
*/
|
|
225
225
|
getAuthorizer() {
|
|
226
|
-
return
|
|
226
|
+
return this.permissions.getAuthorizer();
|
|
227
227
|
}
|
|
228
228
|
getProxyTokenGenerator() {
|
|
229
229
|
return this.proxyDecorator.getProxyTokenGenerator();
|
|
@@ -233,7 +233,7 @@ class ViewFixture {
|
|
|
233
233
|
}
|
|
234
234
|
async loginAsDemoPerson(phone) {
|
|
235
235
|
const { person, token, client } = await this.people.loginAsDemoPerson(phone);
|
|
236
|
-
this.getAuthenticator().setSessionToken(token, person);
|
|
236
|
+
this.permissions.getAuthenticator().setSessionToken(token, person);
|
|
237
237
|
this.proxyDecorator.setProxyTokenGenerator(async () => {
|
|
238
238
|
if (!ViewFixture.loggedInPersonProxyTokens[person.id]) {
|
|
239
239
|
const proxyToken = client.registerProxyToken();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Locale } from '@sprucelabs/calendar-utils';
|
|
2
|
-
import { Router, Scope, SkillViewController, SkillViewControllerArgs, SkillViewControllerId, SkillViewControllerLoadOptions, SkillViewControllerMap, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
|
|
2
|
+
import { Authorizer, Router, Scope, SkillViewController, SkillViewControllerArgs, SkillViewControllerId, SkillViewControllerLoadOptions, SkillViewControllerMap, ViewControllerFactory } from '@sprucelabs/heartwood-view-controllers';
|
|
3
3
|
import { AbstractEventEmitter } from '@sprucelabs/mercury-event-emitter';
|
|
4
4
|
import { MercuryEventEmitter } from '@sprucelabs/mercury-types';
|
|
5
5
|
import FakeThemeManager from '../../__tests__/support/FakeThemeManager';
|
|
@@ -23,6 +23,8 @@ export default class TestRouter extends AbstractEventEmitter<Contract> implement
|
|
|
23
23
|
private scope;
|
|
24
24
|
private locale;
|
|
25
25
|
private readonly themes;
|
|
26
|
+
private authorizer;
|
|
27
|
+
private static authorizer;
|
|
26
28
|
static setShouldThrowWhenRedirectingToBadSvc(shouldThrow: boolean): void;
|
|
27
29
|
private constructor();
|
|
28
30
|
static setShouldLoadDestinationVc(shouldLoad: boolean): void;
|
|
@@ -32,6 +34,7 @@ export default class TestRouter extends AbstractEventEmitter<Contract> implement
|
|
|
32
34
|
vcFactory: ViewControllerFactory;
|
|
33
35
|
scope: Scope;
|
|
34
36
|
locale: Locale;
|
|
37
|
+
authorizer: Authorizer;
|
|
35
38
|
}): void;
|
|
36
39
|
getPresentVc(): SkillViewController<any> | undefined;
|
|
37
40
|
redirect<Id extends SkillViewControllerId>(id: Id, args?: SkillViewControllerArgs<Id>): Promise<SkillViewControllerMap[Id]>;
|
|
@@ -8,7 +8,6 @@ const mercury_event_emitter_1 = require("@sprucelabs/mercury-event-emitter");
|
|
|
8
8
|
const mercury_types_1 = require("@sprucelabs/mercury-types");
|
|
9
9
|
const testRouterEmitPayload_schema_1 = __importDefault(require("./../../.spruce/schemas/spruceTestFixtures/v2021_07_19/testRouterEmitPayload.schema"));
|
|
10
10
|
const FakeThemeManager_1 = __importDefault(require("../../__tests__/support/FakeThemeManager"));
|
|
11
|
-
const FakeAuthorizer_1 = __importDefault(require("../FakeAuthorizer"));
|
|
12
11
|
const contract = (0, mercury_types_1.buildEventContract)({
|
|
13
12
|
eventSignatures: {
|
|
14
13
|
'did-redirect': {
|
|
@@ -26,6 +25,7 @@ class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
|
|
|
26
25
|
this.vcFactory = options.vcFactory;
|
|
27
26
|
this.scope = options.scope;
|
|
28
27
|
this.locale = options.locale;
|
|
28
|
+
this.authorizer = options.authorizer;
|
|
29
29
|
}
|
|
30
30
|
static setShouldLoadDestinationVc(shouldLoad) {
|
|
31
31
|
this.shouldLoadDestinationVc = shouldLoad;
|
|
@@ -36,6 +36,7 @@ class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
|
|
|
36
36
|
vcFactory: this.vcFactory,
|
|
37
37
|
scope: this.scope,
|
|
38
38
|
locale: this.locale,
|
|
39
|
+
authorizer: this.authorizer,
|
|
39
40
|
});
|
|
40
41
|
heartwood_view_controllers_1.routerTestPatcher.patchRedirectToThrow(this.instance);
|
|
41
42
|
}
|
|
@@ -51,6 +52,7 @@ class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
|
|
|
51
52
|
this.vcFactory = options.vcFactory;
|
|
52
53
|
this.scope = options.scope;
|
|
53
54
|
this.locale = options.locale;
|
|
55
|
+
this.authorizer = options.authorizer;
|
|
54
56
|
}
|
|
55
57
|
getPresentVc() {
|
|
56
58
|
return this.presentVc;
|
|
@@ -85,7 +87,7 @@ class TestRouter extends mercury_event_emitter_1.AbstractEventEmitter {
|
|
|
85
87
|
authenticator: heartwood_view_controllers_1.AuthenticatorImpl.getInstance(),
|
|
86
88
|
args,
|
|
87
89
|
locale: this.locale,
|
|
88
|
-
authorizer:
|
|
90
|
+
authorizer: this.authorizer,
|
|
89
91
|
scope: this.scope,
|
|
90
92
|
themes: this.themes,
|
|
91
93
|
};
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@sprucelabs/spruce-test-fixtures"
|
|
14
14
|
]
|
|
15
15
|
},
|
|
16
|
-
"version": "52.5.
|
|
16
|
+
"version": "52.5.6",
|
|
17
17
|
"files": [
|
|
18
18
|
"build/**/*",
|
|
19
19
|
"!build/__tests__",
|
|
@@ -64,14 +64,15 @@
|
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"@sprucelabs/data-stores": "^19.1.13",
|
|
66
66
|
"@sprucelabs/error": "^5.0.555",
|
|
67
|
-
"@sprucelabs/heartwood-view-controllers": "^99.1.
|
|
67
|
+
"@sprucelabs/heartwood-view-controllers": "^99.1.14",
|
|
68
68
|
"@sprucelabs/mercury-client": "^35.0.29",
|
|
69
69
|
"@sprucelabs/mercury-core-events": "^15.0.144",
|
|
70
70
|
"@sprucelabs/mercury-event-emitter": "^35.0.29",
|
|
71
71
|
"@sprucelabs/schema": "^28.5.88",
|
|
72
72
|
"@sprucelabs/spruce-core-schemas": "^35.1.95",
|
|
73
73
|
"@sprucelabs/spruce-event-utils": "^30.0.25",
|
|
74
|
-
"@sprucelabs/spruce-
|
|
74
|
+
"@sprucelabs/spruce-permission-utils": "^1.0.0",
|
|
75
|
+
"@sprucelabs/spruce-skill-booter": "^52.5.6",
|
|
75
76
|
"@sprucelabs/spruce-skill-utils": "^28.1.18",
|
|
76
77
|
"@sprucelabs/test-utils": "^3.2.76",
|
|
77
78
|
"dotenv": "^16.0.3",
|
|
@@ -131,5 +132,5 @@
|
|
|
131
132
|
]
|
|
132
133
|
]
|
|
133
134
|
},
|
|
134
|
-
"gitHead": "
|
|
135
|
+
"gitHead": "708f8b4190cf6ec41041462d4b0c52c2d7bc10b2"
|
|
135
136
|
}
|