@sprucelabs/spruce-heartwood-utils 10.2.16 → 10.2.18
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.
|
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
4
4
|
const schema_1 = require("@sprucelabs/schema");
|
|
5
5
|
const spruce_test_fixtures_1 = require("@sprucelabs/spruce-test-fixtures");
|
|
6
|
-
const test_1 = require("@sprucelabs/test");
|
|
7
6
|
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
7
|
+
const test_utils_2 = require("@sprucelabs/test-utils");
|
|
8
8
|
const remoteVcAssert = {
|
|
9
9
|
async assertSkillViewRendersRemoteCards(options) {
|
|
10
10
|
var _a;
|
|
@@ -15,8 +15,8 @@ const remoteVcAssert = {
|
|
|
15
15
|
]);
|
|
16
16
|
const factory = views.getFactory();
|
|
17
17
|
factory.setController('heartwood.error-card', ThrowingErrorCardVc);
|
|
18
|
-
const vc1Id = (0,
|
|
19
|
-
const vc2Id = (0,
|
|
18
|
+
const vc1Id = (0, test_utils_2.generateId)();
|
|
19
|
+
const vc2Id = (0, test_utils_2.generateId)();
|
|
20
20
|
let wasHit = false;
|
|
21
21
|
let passedTarget;
|
|
22
22
|
let passedPayload;
|
|
@@ -45,25 +45,25 @@ const remoteVcAssert = {
|
|
|
45
45
|
`heartwood({ TestEventViewController1, TestEventViewController2 })`,
|
|
46
46
|
].join('\n');
|
|
47
47
|
return {
|
|
48
|
-
id: (0,
|
|
48
|
+
id: (0, test_utils_2.generateId)(),
|
|
49
49
|
ids: [vc1Id, vc2Id],
|
|
50
50
|
source,
|
|
51
51
|
};
|
|
52
52
|
});
|
|
53
53
|
await views.load(svc, loadArgs);
|
|
54
|
-
|
|
54
|
+
test_utils_1.assert.isTrue(wasHit, `You did not load any remote cards. Next step is to add the following to your skill view's load():\n\nconst registrar = new CardRegistrar(...)\nconst cards = await registrar.fetch(...)\n\nAlso, make sure you create the new event that you'll emit when trying to fetch remote cards, something like 'my-skill.register-cards::v2020_02_02'\n\n`);
|
|
55
55
|
if (expectedTarget) {
|
|
56
|
-
|
|
56
|
+
test_utils_1.assert.isEqualDeep(passedTarget, expectedTarget, 'The target you passed did not match!');
|
|
57
57
|
}
|
|
58
58
|
if (expectedPayload) {
|
|
59
|
-
|
|
59
|
+
test_utils_1.assert.isEqualDeep(passedPayload, expectedPayload, 'The payload you passed did not match!');
|
|
60
60
|
}
|
|
61
61
|
let cards = [];
|
|
62
62
|
try {
|
|
63
63
|
cards = heartwood_view_controllers_1.vcAssert.assertSkillViewRendersCards(svc, [vc1Id, vc2Id]);
|
|
64
64
|
}
|
|
65
65
|
catch (err) {
|
|
66
|
-
|
|
66
|
+
test_utils_1.assert.fail(`You didn't drop in the cards to your skill view! Make sure your vcIdsTransformer looks something like:
|
|
67
67
|
|
|
68
68
|
vcIdsTransformer: (payload) => {
|
|
69
69
|
return payload.vcIds
|
|
@@ -86,13 +86,13 @@ The original error is: ${(_a = err.stack) !== null && _a !== void 0 ? _a : err.m
|
|
|
86
86
|
}
|
|
87
87
|
if (shouldInvoke) {
|
|
88
88
|
const { methodName, expectedParams } = shouldInvoke;
|
|
89
|
-
|
|
89
|
+
test_utils_1.assert.isTrue(
|
|
90
90
|
//@ts-ignore
|
|
91
91
|
cards.filter((c) => c.wasHit).length === cards.length, `You gotta call cardVc.${methodName}(...) on all the cards you get back!`);
|
|
92
92
|
if (expectedParams) {
|
|
93
93
|
//@ts-ignore
|
|
94
94
|
const passed = cards[0].passedParams;
|
|
95
|
-
|
|
95
|
+
test_utils_1.assert.isEqualDeep(passed, expectedParams, `You didn't pass the expected params to ${methodName}!`);
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
},
|
|
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
import { AbstractViewController, vcAssert, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
11
|
import { assertOptions } from '@sprucelabs/schema';
|
|
12
12
|
import { eventFaker, } from '@sprucelabs/spruce-test-fixtures';
|
|
13
|
-
import { assert } from '@sprucelabs/test';
|
|
13
|
+
import { assert } from '@sprucelabs/test-utils';
|
|
14
14
|
import { generateId } from '@sprucelabs/test-utils';
|
|
15
15
|
const remoteVcAssert = {
|
|
16
16
|
assertSkillViewRendersRemoteCards(options) {
|