@sprucelabs/spruce-cli 24.1.2 → 24.1.3
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/CHANGELOG.md +8 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.d.ts +2 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js +16 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest2.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest2.txt +24 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +8 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +1 -1
- package/build/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest4.txt +520 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +8 -0
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +1 -1
- package/build/__tests__/behavioral/tests/migrationToInstance/support/StaticTest4.txt +519 -0
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js +17 -13
- package/build/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts +16 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest2.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/AbstractStaticTest2.txt +24 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest.txt +8 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest3.txt +1 -1
- package/src/__tests__/behavioral/tests/migrationToInstance/support/InstanceTest4.txt +520 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest.txt +8 -0
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest3.txt +1 -1
- package/src/__tests__/behavioral/tests/migrationToInstance/support/StaticTest4.txt +519 -0
- package/src/tests/staticToInstanceMigration/StaticToInstanceTestFileMigrator.ts +23 -16
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [24.1.3](https://github.com/sprucelabsai-community/spruce-cli-workspace/compare/v24.1.2...v24.1.3) (2025-02-27)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [24.1.2](https://github.com/sprucelabsai-community/spruce-cli-workspace/compare/v24.1.1...v24.1.2) (2025-02-26)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -16,8 +16,10 @@ export default class StaticToInstanceTestFileMigratorTest extends AbstractSpruce
|
|
|
16
16
|
protected includesSuiteWithMultipleImports(): void;
|
|
17
17
|
protected canMigrateWholeTest(): void;
|
|
18
18
|
protected properlyMigrationsAbstractTests(): void;
|
|
19
|
+
protected properlyMigrationsAbstractTests2(): void;
|
|
19
20
|
protected canMigrateMoreComplexTest(): void;
|
|
20
21
|
protected canMigrateAnotherComplexTest(): void;
|
|
22
|
+
protected canMigrateAnotherComplexTest2(): void;
|
|
21
23
|
private readTestFile;
|
|
22
24
|
private resolveTestClassPath;
|
|
23
25
|
private assertMigratedEquals;
|
|
@@ -115,6 +115,11 @@ protected suiteMethod() {}`);
|
|
|
115
115
|
const expected = this.readTestFile('AbstractInstanceTest.txt');
|
|
116
116
|
this.assertMigratedEquals(before, expected);
|
|
117
117
|
}
|
|
118
|
+
properlyMigrationsAbstractTests2() {
|
|
119
|
+
const before = this.readTestFile('AbstractStaticTest2.txt');
|
|
120
|
+
const expected = this.readTestFile('AbstractInstanceTest2.txt');
|
|
121
|
+
this.assertMigratedEquals(before, expected);
|
|
122
|
+
}
|
|
118
123
|
canMigrateMoreComplexTest() {
|
|
119
124
|
const before = this.readTestFile('StaticTest2.txt');
|
|
120
125
|
const expected = this.readTestFile('InstanceTest2.txt');
|
|
@@ -125,6 +130,11 @@ protected suiteMethod() {}`);
|
|
|
125
130
|
const expected = this.readTestFile('InstanceTest3.txt');
|
|
126
131
|
this.assertMigratedEquals(before, expected);
|
|
127
132
|
}
|
|
133
|
+
canMigrateAnotherComplexTest2() {
|
|
134
|
+
const before = this.readTestFile('StaticTest4.txt');
|
|
135
|
+
const expected = this.readTestFile('InstanceTest4.txt');
|
|
136
|
+
this.assertMigratedEquals(before, expected);
|
|
137
|
+
}
|
|
128
138
|
readTestFile(name) {
|
|
129
139
|
return spruce_skill_utils_1.diskUtil.readFile(this.resolveTestClassPath(name));
|
|
130
140
|
}
|
|
@@ -189,12 +199,18 @@ __decorate([
|
|
|
189
199
|
__decorate([
|
|
190
200
|
(0, test_utils_1.test)()
|
|
191
201
|
], StaticToInstanceTestFileMigratorTest.prototype, "properlyMigrationsAbstractTests", null);
|
|
202
|
+
__decorate([
|
|
203
|
+
(0, test_utils_1.test)()
|
|
204
|
+
], StaticToInstanceTestFileMigratorTest.prototype, "properlyMigrationsAbstractTests2", null);
|
|
192
205
|
__decorate([
|
|
193
206
|
(0, test_utils_1.test)()
|
|
194
207
|
], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateMoreComplexTest", null);
|
|
195
208
|
__decorate([
|
|
196
209
|
(0, test_utils_1.test)()
|
|
197
210
|
], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateAnotherComplexTest", null);
|
|
211
|
+
__decorate([
|
|
212
|
+
(0, test_utils_1.test)()
|
|
213
|
+
], StaticToInstanceTestFileMigratorTest.prototype, "canMigrateAnotherComplexTest2", null);
|
|
198
214
|
StaticToInstanceTestFileMigratorTest = __decorate([
|
|
199
215
|
(0, test_utils_1.suite)()
|
|
200
216
|
], StaticToInstanceTestFileMigratorTest);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StaticToInstanceTestFileMigrator.test.js","sourceRoot":"","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,qEAK+B;AAC/B,oJAEqF;AAGtE,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,oBAAkB;IACxE,QAAQ,GACZ,0CAAoC,CAAC,QAAQ,EAAE,CAAA;IAGzC,iBAAiB;QACvB,YAAY;QACZ,MAAM,GAAG,GAAG,mBAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QAClD,wBAAW,CAAC,WAAW,CAAC,GAAG,EAAE,oBAAoB,EAAE;YAC/C,UAAU,EAAE,CAAC,UAAU,CAAC;SAC3B,CAAC,CAAA;IACN,CAAC;IAGS,kBAAkB;QACxB,IAAI,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IACrC,CAAC;IAGS,mBAAmB;QACzB,IAAI,CAAC,oBAAoB,CACrB;6BACiB,EACjB;sBACU,CACb,CAAA;IACL,CAAC;IAGS,yBAAyB;QAC/B,IAAI,CAAC,oBAAoB,CACrB;mCACuB,EACvB;4BACgB,CACnB,CAAA;IACL,CAAC;IAGS,mCAAmC;QACzC,IAAI,CAAC,oBAAoB,CACrB,6BAA6B,EAC7B,6BAA6B,CAChC,CAAA;IACL,CAAC;IAGS,mCAAmC;QACzC,IAAI,CAAC,oBAAoB,CACrB,8BAA8B,EAC9B,wCAAwC,CAC3C,CAAA;IACL,CAAC;IAGS,oCAAoC;QAC1C,IAAI,CAA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","sources":["../../../../../src/__tests__/behavioral/tests/migrationToInstance/StaticToInstanceTestFileMigrator.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uEAAyD;AACzD,qEAK+B;AAC/B,oJAEqF;AAGtE,IAAM,oCAAoC,GAA1C,MAAM,oCAAqC,SAAQ,oBAAkB;IACxE,QAAQ,GACZ,0CAAoC,CAAC,QAAQ,EAAE,CAAA;IAGzC,iBAAiB;QACvB,YAAY;QACZ,MAAM,GAAG,GAAG,mBAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAA;QAClD,wBAAW,CAAC,WAAW,CAAC,GAAG,EAAE,oBAAoB,EAAE;YAC/C,UAAU,EAAE,CAAC,UAAU,CAAC;SAC3B,CAAC,CAAA;IACN,CAAC;IAGS,kBAAkB;QACxB,IAAI,CAAC,oBAAoB,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IACrC,CAAC;IAGS,mBAAmB;QACzB,IAAI,CAAC,oBAAoB,CACrB;6BACiB,EACjB;sBACU,CACb,CAAA;IACL,CAAC;IAGS,yBAAyB;QAC/B,IAAI,CAAC,oBAAoB,CACrB;mCACuB,EACvB;4BACgB,CACnB,CAAA;IACL,CAAC;IAGS,mCAAmC;QACzC,IAAI,CAAC,oBAAoB,CACrB,6BAA6B,EAC7B,6BAA6B,CAChC,CAAA;IACL,CAAC;IAGS,mCAAmC;QACzC,IAAI,CAAC,oBAAoB,CACrB,8BAA8B,EAC9B,wCAAwC,CAC3C,CAAA;IACL,CAAC;IAGS,oCAAoC;QAC1C,IAAI,CAAC,oBAAoB,CACrB,sBAAsB,EACtB,sBAAsB,CACzB,CAAA;IACL,CAAC;IAGS,6BAA6B;QACnC,IAAI,CAAC,oBAAoB,CACrB,wCAAwC,EACxC,wCAAwC,CAC3C,CAAA;IACL,CAAC;IAGS,oBAAoB;QAC1B,IAAI,CAAC,oBAAoB,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,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IAClD,CAAC;IAEO,OAAO,CAAC,QAAgB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC;CACJ,CAAA;AA/La;IADT,IAAA,iBAAI,GAAE;6EAON;AAGS;IADT,IAAA,iBAAI,GAAE;8EAGN;AAGS;IADT,IAAA,iBAAI,GAAE;+EAQN;AAGS;IADT,IAAA,iBAAI,GAAE;qFAQN;AAGS;IADT,IAAA,iBAAI,GAAE;+FAMN;AAGS;IADT,IAAA,iBAAI,GAAE;+FAMN;AAGS;IADT,IAAA,iBAAI,GAAE;gGAMN;AAGS;IADT,IAAA,iBAAI,GAAE;yFAMN;AAGS;IADT,IAAA,iBAAI,GAAE;gFAMN;AAGS;IADT,IAAA,iBAAI,GAAE;iGAMN;AAGS;IADT,IAAA,iBAAI,GAAE;mFAMN;AAGS;IADT,IAAA,iBAAI,GAAE;mGAQN;AAGS;IADT,IAAA,iBAAI,GAAE;4FAeN;AAGS;IADT,IAAA,iBAAI,GAAE;+EAMN;AAGS;IADT,IAAA,iBAAI,GAAE;2FAMN;AAGS;IADT,IAAA,iBAAI,GAAE;4FAMN;AAGS;IADT,IAAA,iBAAI,GAAE;qFAMN;AAGS;IADT,IAAA,iBAAI,GAAE;wFAMN;AAGS;IADT,IAAA,iBAAI,GAAE;yFAMN;AAvKgB,oCAAoC;IADxD,IAAA,kBAAK,GAAE;GACa,oCAAoC,CAoMxD;kBApMoB,oCAAoC"}
|
package/build/__tests__/behavioral/tests/migrationToInstance/support/AbstractInstanceTest2.txt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AbstractSpruceFixtureTest } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import { assert } from '@sprucelabs/test-utils'
|
|
3
|
+
import HomeIntegrationsStore from '../../stores/HomeIntegrations.store'
|
|
4
|
+
import EventFaker from './EventFaker'
|
|
5
|
+
|
|
6
|
+
export default class AbstractGoogleTest extends AbstractSpruceFixtureTest {
|
|
7
|
+
protected eventFaker!: EventFaker
|
|
8
|
+
private homeIntegrations!: HomeIntegrationsStore
|
|
9
|
+
|
|
10
|
+
protected async beforeEach(): Promise<void> {
|
|
11
|
+
await super.beforeEach()
|
|
12
|
+
this.eventFaker = new EventFaker()
|
|
13
|
+
this.homeIntegrations = await this.stores.getStore('homeIntegrations')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
protected async getFirstHomeIntegration() {
|
|
17
|
+
const match = await this.homeIntegrations.findOne(
|
|
18
|
+
{},
|
|
19
|
+
{ shouldIncludePrivateFields: true }
|
|
20
|
+
)
|
|
21
|
+
assert.isTruthy(match, 'No home integration found')
|
|
22
|
+
return match
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { AbstractSpruceFixtureTest } from '@sprucelabs/spruce-test-fixtures'
|
|
2
|
+
import { assert } from '@sprucelabs/test-utils'
|
|
3
|
+
import HomeIntegrationsStore from '../../stores/HomeIntegrations.store'
|
|
4
|
+
import EventFaker from './EventFaker'
|
|
5
|
+
|
|
6
|
+
export default class AbstractGoogleTest extends AbstractSpruceFixtureTest {
|
|
7
|
+
protected static eventFaker: EventFaker
|
|
8
|
+
private static homeIntegrations: HomeIntegrationsStore
|
|
9
|
+
|
|
10
|
+
protected static async beforeEach(): Promise<void> {
|
|
11
|
+
await super.beforeEach()
|
|
12
|
+
this.eventFaker = new EventFaker()
|
|
13
|
+
this.homeIntegrations = await this.stores.getStore('homeIntegrations')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
protected static async getFirstHomeIntegration() {
|
|
17
|
+
const match = await this.homeIntegrations.findOne(
|
|
18
|
+
{},
|
|
19
|
+
{ shouldIncludePrivateFields: true }
|
|
20
|
+
)
|
|
21
|
+
assert.isTruthy(match, 'No home integration found')
|
|
22
|
+
return match
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -10,10 +10,13 @@ import AbstractSpruceTest, {
|
|
|
10
10
|
@fake.login()
|
|
11
11
|
@suite()
|
|
12
12
|
export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
13
|
+
private responseBody = generateId()
|
|
14
|
+
|
|
13
15
|
@test()
|
|
14
16
|
protected async throwsWithMissing() {
|
|
15
17
|
const finder = StaticTestFinder.Finder()
|
|
16
18
|
const err = await assert.doesThrowAsync(() => finder.find())
|
|
19
|
+
console.log(this.responseBody)
|
|
17
20
|
errorAssert.assertError(err, 'MISSING_PARAMETERS', {
|
|
18
21
|
parameters: ['lookupDir'],
|
|
19
22
|
})
|
|
@@ -23,6 +26,11 @@ export default class StaticTestFinderTest extends AbstractSpruceTest {
|
|
|
23
26
|
protected async yourNextTest() {
|
|
24
27
|
assert.isTrue(false)
|
|
25
28
|
}
|
|
29
|
+
|
|
30
|
+
@test('this has a description')
|
|
31
|
+
protected async anotherTest() {
|
|
32
|
+
assert.isFalse(true)
|
|
33
|
+
}
|
|
26
34
|
}
|
|
27
35
|
|
|
28
36
|
class StaticTestFinder {
|
|
@@ -21,7 +21,7 @@ export default class RootSkillViewTest extends AbstractGoogleTest {
|
|
|
21
21
|
private fakedIntegrations: PublicHomeIntegration[] = []
|
|
22
22
|
protected names: string[] = []
|
|
23
23
|
|
|
24
|
-
protected async beforeEach()
|
|
24
|
+
protected async beforeEach() {
|
|
25
25
|
await super.beforeEach()
|
|
26
26
|
|
|
27
27
|
this.fakedIntegrations = []
|
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import {
|
|
2
|
+
FormViewController,
|
|
3
|
+
SkillViewControllerId,
|
|
4
|
+
buttonAssert,
|
|
5
|
+
formAssert,
|
|
6
|
+
interactor,
|
|
7
|
+
navigationAssert,
|
|
8
|
+
vcAssert,
|
|
9
|
+
} from '@sprucelabs/heartwood-view-controllers'
|
|
10
|
+
import { selectAssert } from '@sprucelabs/schema'
|
|
11
|
+
import { SelectChoice } from '@sprucelabs/spruce-core-schemas'
|
|
12
|
+
import { FormCardViewController } from '@sprucelabs/spruce-form-utils'
|
|
13
|
+
import { eventFaker, fake, seed } from '@sprucelabs/spruce-test-fixtures'
|
|
14
|
+
import { assert, generateId, test, suite } from '@sprucelabs/test-utils'
|
|
15
|
+
import GenerateSkillViewController, {
|
|
16
|
+
CurrentChallengeSchema,
|
|
17
|
+
GenerateStorySchema,
|
|
18
|
+
} from '../../../generation/Generate.svc'
|
|
19
|
+
import { storyElements } from '../../../generation/storyElements'
|
|
20
|
+
import AbstractEightBitTest from '../../support/AbstractEightBitTest'
|
|
21
|
+
import {
|
|
22
|
+
GenerateStoryTargetAndPayload,
|
|
23
|
+
GetStoryStatusTargetAndPayload,
|
|
24
|
+
} from '../../support/EventFaker'
|
|
25
|
+
|
|
26
|
+
@fake.login()
|
|
27
|
+
@suite()
|
|
28
|
+
export default class GenerateSkillViewTest extends AbstractEightBitTest {
|
|
29
|
+
private vc!: SpyGenerateSkillView
|
|
30
|
+
private checkStatusIntervalCb: undefined | (() => Promise<void>)
|
|
31
|
+
private checkStatusIntervalMs!: number | undefined
|
|
32
|
+
private intervalId!: string
|
|
33
|
+
private passedIntervalIdToClear?: string
|
|
34
|
+
|
|
35
|
+
@seed('familyMembers', 3)
|
|
36
|
+
protected async beforeEach(): Promise<void> {
|
|
37
|
+
await super.beforeEach()
|
|
38
|
+
|
|
39
|
+
this.views.setController(
|
|
40
|
+
'eightbitstories.generate',
|
|
41
|
+
SpyGenerateSkillView
|
|
42
|
+
)
|
|
43
|
+
this.views.setController('forms.card', SpyFormCard)
|
|
44
|
+
|
|
45
|
+
this.vc = this.Vc()
|
|
46
|
+
|
|
47
|
+
await this.eventFaker.fakeListFamilyMembers(() => this.members.find({}))
|
|
48
|
+
await this.loadVc()
|
|
49
|
+
|
|
50
|
+
delete this.checkStatusIntervalCb
|
|
51
|
+
delete this.checkStatusIntervalMs
|
|
52
|
+
delete this.passedIntervalIdToClear
|
|
53
|
+
|
|
54
|
+
this.intervalId = generateId()
|
|
55
|
+
|
|
56
|
+
//@ts-ignore
|
|
57
|
+
GenerateSkillViewController.setInterval = (
|
|
58
|
+
cb: () => Promise<void>,
|
|
59
|
+
intervalMs: number
|
|
60
|
+
) => {
|
|
61
|
+
this.checkStatusIntervalMs = intervalMs
|
|
62
|
+
this.checkStatusIntervalCb = cb
|
|
63
|
+
return this.intervalId
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
//@ts-ignore
|
|
67
|
+
GenerateSkillViewController.clearInterval = (id: string) => {
|
|
68
|
+
this.passedIntervalIdToClear = id
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@test()
|
|
73
|
+
protected async requiresLogin() {
|
|
74
|
+
await vcAssert.assertLoginIsRequired(this.vc)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@test()
|
|
78
|
+
protected async rendersExpectedCards() {
|
|
79
|
+
vcAssert.assertSkillViewRendersCards(this.vc, [
|
|
80
|
+
'elements',
|
|
81
|
+
'members',
|
|
82
|
+
'currentChallenge',
|
|
83
|
+
'controls',
|
|
84
|
+
])
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@test()
|
|
88
|
+
protected async controlsCardRendersExpectedButtons() {
|
|
89
|
+
buttonAssert.cardRendersButtons(this.controlsVc, ['back', 'generate'])
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@test()
|
|
93
|
+
protected async rendersAlertAndRedirectsIfNoMembers() {
|
|
94
|
+
await this.eventFaker.fakeListFamilyMembers(() => [])
|
|
95
|
+
this.vc = this.Vc()
|
|
96
|
+
await vcAssert.assertRendersAlertThenRedirects({
|
|
97
|
+
vc: this.vc,
|
|
98
|
+
router: this.views.getRouter(),
|
|
99
|
+
destination: {
|
|
100
|
+
id: 'eightbitstories.root',
|
|
101
|
+
},
|
|
102
|
+
action: () => this.loadVc(),
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
@test()
|
|
107
|
+
protected async clickingBackGoesBackToRoot() {
|
|
108
|
+
await vcAssert.assertActionRedirects({
|
|
109
|
+
action: () => interactor.clickButton(this.controlsVc, 'back'),
|
|
110
|
+
destination: {
|
|
111
|
+
id: 'eightbitstories.root',
|
|
112
|
+
},
|
|
113
|
+
router: this.views.getRouter(),
|
|
114
|
+
})
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@test()
|
|
118
|
+
protected elementsAndMembersCardsRendersForms() {
|
|
119
|
+
formAssert.cardRendersForm(this.elementsVc)
|
|
120
|
+
formAssert.cardRendersForm(this.membersVc)
|
|
121
|
+
formAssert.cardRendersForm(this.currentChallengeVc)
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@test()
|
|
125
|
+
protected async formCardsDoNotRenderButtons() {
|
|
126
|
+
assert.isFalse(this.elementsFormVc.getShouldRenderSubmitControls())
|
|
127
|
+
assert.isFalse(this.membersFormVc.getShouldRenderSubmitControls())
|
|
128
|
+
assert.isFalse(
|
|
129
|
+
this.currentChallengeFormVc.getShouldRenderSubmitControls()
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@test()
|
|
134
|
+
protected async elementsFormRendersExpectedFields() {
|
|
135
|
+
formAssert.formRendersFields(this.elementsFormVc, ['elements'])
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@test()
|
|
139
|
+
protected async elementsFormRendersExpectedChoices() {
|
|
140
|
+
const schema = this.elementsFormVc.getSchema()
|
|
141
|
+
selectAssert.assertSelectChoicesMatch(
|
|
142
|
+
schema.fields.elements.options.choices,
|
|
143
|
+
storyElements.map((element) => element.id)
|
|
144
|
+
)
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
@test()
|
|
148
|
+
protected async rendersElementsAsTags() {
|
|
149
|
+
formAssert.formFieldRendersAs(this.elementsFormVc, 'elements', 'tags')
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@test()
|
|
153
|
+
protected async membersFormRendersExpectedFields() {
|
|
154
|
+
formAssert.formRendersFields(this.membersFormVc, ['members'])
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@test()
|
|
158
|
+
protected async membersFormRendersAsTags() {
|
|
159
|
+
formAssert.formFieldRendersAs(this.membersFormVc, 'members', 'tags')
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
@test()
|
|
163
|
+
protected async membersRendersExpectedChoices() {
|
|
164
|
+
const members = await this.getAllMembers()
|
|
165
|
+
const expected = members.map((member) => member.id)
|
|
166
|
+
|
|
167
|
+
const schema = this.membersFormVc.getSchema()
|
|
168
|
+
selectAssert.assertSelectChoicesMatch(
|
|
169
|
+
schema.fields.members.options.choices as SelectChoice[],
|
|
170
|
+
expected
|
|
171
|
+
)
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@test()
|
|
175
|
+
protected async currentChallengeFormRendersAsExpected() {
|
|
176
|
+
formAssert.formRendersField(
|
|
177
|
+
this.currentChallengeFormVc,
|
|
178
|
+
'currentChallenge'
|
|
179
|
+
)
|
|
180
|
+
formAssert.formFieldRendersAs(
|
|
181
|
+
this.currentChallengeFormVc,
|
|
182
|
+
'currentChallenge',
|
|
183
|
+
'textarea'
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@test()
|
|
188
|
+
protected async clickingGenerateSetsControlsToBusy() {
|
|
189
|
+
await this.eventFaker.fakeGenerateStory(() => {})
|
|
190
|
+
|
|
191
|
+
await this.selectFirstMember()
|
|
192
|
+
await this.selectFirstElement()
|
|
193
|
+
|
|
194
|
+
const promise = this.clickGenerateAndAssertRedirect()
|
|
195
|
+
this.assertFooterIsBusy()
|
|
196
|
+
|
|
197
|
+
await promise
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
@test()
|
|
201
|
+
protected async rendersAlertIfFailsToGenerateStory() {
|
|
202
|
+
await eventFaker.makeEventThrow(
|
|
203
|
+
'eightbitstories.generate-story::v2023_09_05'
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
const alertVc = await vcAssert.assertRendersAlert(this.vc, () =>
|
|
207
|
+
this.clickGenerate()
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
this.assertFooterIsBusy()
|
|
211
|
+
|
|
212
|
+
await alertVc.hide()
|
|
213
|
+
|
|
214
|
+
this.assertFooterIsNotBusy()
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@test('submits selected members and elements 1', [0], [0])
|
|
218
|
+
@test('submits selected members and elements 2', [1], [2])
|
|
219
|
+
@test('submits selected members and elements 3', [0, 1], [2, 3])
|
|
220
|
+
protected async generatePassesSelectedMembersAndElements(
|
|
221
|
+
memberIdxs: number[],
|
|
222
|
+
elementIdxs: number[]
|
|
223
|
+
) {
|
|
224
|
+
let passedPayload: GenerateStoryTargetAndPayload['payload'] | undefined
|
|
225
|
+
|
|
226
|
+
await this.eventFaker.fakeGenerateStory(({ payload }) => {
|
|
227
|
+
passedPayload = payload
|
|
228
|
+
})
|
|
229
|
+
|
|
230
|
+
const selectedMembers = await this.selectMembers(memberIdxs)
|
|
231
|
+
const selectedElements = await this.selectElements(elementIdxs)
|
|
232
|
+
|
|
233
|
+
const currentChallenge = generateId()
|
|
234
|
+
await this.currentChallengeFormVc.setValue(
|
|
235
|
+
'currentChallenge',
|
|
236
|
+
currentChallenge
|
|
237
|
+
)
|
|
238
|
+
|
|
239
|
+
await this.clickGenerateAndAssertRedirect()
|
|
240
|
+
|
|
241
|
+
assert.isEqualDeep(passedPayload, {
|
|
242
|
+
familyMembers: selectedMembers,
|
|
243
|
+
storyElements: selectedElements,
|
|
244
|
+
currentChallenge,
|
|
245
|
+
storyHash: this.vc.getHash(),
|
|
246
|
+
})
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
@test()
|
|
250
|
+
protected async generatingStoryRedirectsToStoryWithArgs() {
|
|
251
|
+
await this.eventFaker.fakeGenerateStory()
|
|
252
|
+
|
|
253
|
+
await this.selectFirstElement()
|
|
254
|
+
await this.selectFirstMember()
|
|
255
|
+
|
|
256
|
+
const destination = {
|
|
257
|
+
id: 'eightbitstories.story' as SkillViewControllerId,
|
|
258
|
+
args: {
|
|
259
|
+
story: generateId(),
|
|
260
|
+
},
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
await this.clickGenerateAndAssertRedirect(destination)
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
@test()
|
|
267
|
+
protected async callingDestroyRemovesDidGenerateListener() {
|
|
268
|
+
await this.vc.destroy()
|
|
269
|
+
|
|
270
|
+
await eventFaker.handleReactiveEvent(
|
|
271
|
+
'eightbitstories.did-generate-story::v2023_09_05'
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
await this.emitDidGenerate()
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
@test()
|
|
278
|
+
protected async rendersNullNavigation() {
|
|
279
|
+
navigationAssert.skillViewDoesNotRenderNavigation(this.vc)
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
@test()
|
|
283
|
+
protected async checksForGeneratedStoryAfterSubmitting() {
|
|
284
|
+
let passedTarget: GetStoryStatusTargetAndPayload['target'] | undefined
|
|
285
|
+
await this.eventFaker.fakeGetStoryGenerationStatus(({ target }) => {
|
|
286
|
+
passedTarget = target
|
|
287
|
+
})
|
|
288
|
+
|
|
289
|
+
await this.fakeGenerateSelectEverythingClickGenerateAndInvokeIntervalCb()
|
|
290
|
+
|
|
291
|
+
assert.isEqualDeep(passedTarget, {
|
|
292
|
+
storyHash: this.vc.getHash(),
|
|
293
|
+
})
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
@test()
|
|
297
|
+
protected async passesExpectedIntervalToChecksAfterSubmit() {
|
|
298
|
+
await this.eventFaker.fakeGenerateStory()
|
|
299
|
+
await this.selectElementFamilyMemberAndClickGenerate()
|
|
300
|
+
assert.isEqual(this.checkStatusIntervalMs, 1000 * 10)
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
@test()
|
|
304
|
+
protected async doesNotSetIntervalIfGenerateThrows() {
|
|
305
|
+
await eventFaker.makeEventThrow(
|
|
306
|
+
'eightbitstories.generate-story::v2023_09_05'
|
|
307
|
+
)
|
|
308
|
+
|
|
309
|
+
await vcAssert.assertRendersAlert(this.vc, () =>
|
|
310
|
+
this.selectElementFamilyMemberAndClickGenerate()
|
|
311
|
+
)
|
|
312
|
+
assert.isUndefined(
|
|
313
|
+
this.checkStatusIntervalCb,
|
|
314
|
+
'should not have been set'
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
@test()
|
|
319
|
+
protected async redirectsIfResponseIsStoryGenerated() {
|
|
320
|
+
const storyId = generateId()
|
|
321
|
+
await this.eventFaker.fakeGetStoryGenerationStatus(() => {
|
|
322
|
+
return {
|
|
323
|
+
status: 'ready',
|
|
324
|
+
storyId,
|
|
325
|
+
}
|
|
326
|
+
})
|
|
327
|
+
|
|
328
|
+
await this.fakeGenerateSelectEverythingAndClickGenerate()
|
|
329
|
+
await vcAssert.assertActionRedirects({
|
|
330
|
+
action: () => this.checkStatusIntervalCb?.(),
|
|
331
|
+
destination: {
|
|
332
|
+
id: 'eightbitstories.story',
|
|
333
|
+
args: {
|
|
334
|
+
story: storyId,
|
|
335
|
+
},
|
|
336
|
+
},
|
|
337
|
+
router: this.views.getRouter(),
|
|
338
|
+
})
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
@test()
|
|
342
|
+
protected async clearsTimeoutOnBlur() {
|
|
343
|
+
await this.fakeGenerateSelectEverythingAndClickGenerate()
|
|
344
|
+
assert.isFalsy(this.passedIntervalIdToClear)
|
|
345
|
+
await interactor.blur(this.vc)
|
|
346
|
+
assert.isEqual(
|
|
347
|
+
this.passedIntervalIdToClear,
|
|
348
|
+
this.intervalId,
|
|
349
|
+
'did not pass response to setInterval to clearInterval'
|
|
350
|
+
)
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
private async fakeGenerateSelectEverythingClickGenerateAndInvokeIntervalCb() {
|
|
354
|
+
await this.fakeGenerateSelectEverythingAndClickGenerate()
|
|
355
|
+
await this.checkStatusIntervalCb?.()
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
private async fakeGenerateSelectEverythingAndClickGenerate() {
|
|
359
|
+
await this.eventFaker.fakeGenerateStory()
|
|
360
|
+
await this.selectElementFamilyMemberAndClickGenerate()
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
private async selectElementFamilyMemberAndClickGenerate() {
|
|
364
|
+
await this.selectFirstElement()
|
|
365
|
+
await this.selectFirstMember()
|
|
366
|
+
await this.clickGenerate()
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
private async clickGenerateAndAssertRedirect(destination?: {
|
|
370
|
+
id: SkillViewControllerId
|
|
371
|
+
args: { story: string }
|
|
372
|
+
}) {
|
|
373
|
+
await vcAssert.assertActionRedirects({
|
|
374
|
+
action: async () => {
|
|
375
|
+
await this.clickGenerate()
|
|
376
|
+
await this.emitDidGenerate(destination?.args?.story)
|
|
377
|
+
},
|
|
378
|
+
router: this.views.getRouter(),
|
|
379
|
+
destination,
|
|
380
|
+
})
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
private async emitDidGenerate(storyId?: string) {
|
|
384
|
+
await this.fakedClient.emitAndFlattenResponses(
|
|
385
|
+
'eightbitstories.did-generate-story::v2023_09_05',
|
|
386
|
+
{
|
|
387
|
+
target: {
|
|
388
|
+
personId: generateId(),
|
|
389
|
+
},
|
|
390
|
+
payload: {
|
|
391
|
+
storyId: storyId ?? generateId(),
|
|
392
|
+
},
|
|
393
|
+
}
|
|
394
|
+
)
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
private async selectFirstElement() {
|
|
398
|
+
const selectedElement = await this.selectElement(0)
|
|
399
|
+
return selectedElement
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
private async selectElement(idx: number) {
|
|
403
|
+
const selectedElements = await this.selectElements([idx])
|
|
404
|
+
return selectedElements[0]
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
private async selectElements(allIdxs: number[]) {
|
|
408
|
+
const selectedElements = allIdxs.map((idx) => storyElements[idx].id)
|
|
409
|
+
await this.elementsFormVc.setValue('elements', selectedElements)
|
|
410
|
+
return selectedElements
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
private async selectFirstMember() {
|
|
414
|
+
const selectedMember = await this.selectMember(0)
|
|
415
|
+
return selectedMember
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
private async selectMember(idx: number) {
|
|
419
|
+
const selectedMembers = await this.selectMembers([idx])
|
|
420
|
+
return selectedMembers[0]
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
private async selectMembers(allIdxs: number[]) {
|
|
424
|
+
const members = await this.getAllMembers()
|
|
425
|
+
const selectedMembers = allIdxs.map((idx) => members[idx].id)
|
|
426
|
+
await this.membersFormVc.setValue('members', selectedMembers as any)
|
|
427
|
+
return selectedMembers
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
private async getAllMembers() {
|
|
431
|
+
return await this.members.find({})
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
private assertFooterIsNotBusy() {
|
|
435
|
+
assert.isFalse(this.getIsFooterBusy())
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
private assertFooterIsBusy() {
|
|
439
|
+
assert.isTrue(this.getIsFooterBusy())
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
private getIsFooterBusy(): boolean | null | undefined {
|
|
443
|
+
return this.controlsVc.getFooter()?.isBusy
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
private async clickGenerate() {
|
|
447
|
+
await interactor.clickButton(this.controlsVc, 'generate')
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
private get membersFormVc() {
|
|
451
|
+
return this.vc.getMembersFormVc()
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
private get elementsFormVc() {
|
|
455
|
+
return this.vc.getElementsFormVc()
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
private async loadVc() {
|
|
459
|
+
await this.views.load(this.vc)
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
private get membersVc() {
|
|
463
|
+
return this.vc.getMembersVc()
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
private get currentChallengeVc() {
|
|
467
|
+
return this.vc.getCurrentChallengeVc()
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
private get currentChallengeFormVc() {
|
|
471
|
+
return this.currentChallengeVc.getFormVc() as FormViewController<CurrentChallengeSchema>
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
private get elementsVc() {
|
|
475
|
+
return this.vc.getElementsVc()
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
private get controlsVc() {
|
|
479
|
+
return this.vc.getControlsCardVc()
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
private Vc(): SpyGenerateSkillView {
|
|
483
|
+
return this.views.Controller(
|
|
484
|
+
'eightbitstories.generate',
|
|
485
|
+
{}
|
|
486
|
+
) as SpyGenerateSkillView
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
class SpyGenerateSkillView extends GenerateSkillViewController {
|
|
491
|
+
public getHash() {
|
|
492
|
+
return this.storyHash!
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
public getCurrentChallengeVc() {
|
|
496
|
+
return this.currentChallengeVc
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
public getMembersFormVc() {
|
|
500
|
+
return this.getMembersVc().getFormVc() as FormViewController<GenerateStorySchema>
|
|
501
|
+
}
|
|
502
|
+
public getElementsFormVc() {
|
|
503
|
+
return this.getElementsVc().getFormVc() as FormViewController<GenerateStorySchema>
|
|
504
|
+
}
|
|
505
|
+
public getElementsVc() {
|
|
506
|
+
return this.elementsVc as SpyFormCard
|
|
507
|
+
}
|
|
508
|
+
public getMembersVc() {
|
|
509
|
+
return this.membersVc as SpyFormCard
|
|
510
|
+
}
|
|
511
|
+
public getControlsCardVc() {
|
|
512
|
+
return this.controlsVc
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
class SpyFormCard extends FormCardViewController {
|
|
517
|
+
public getFormVc() {
|
|
518
|
+
return this.formVc
|
|
519
|
+
}
|
|
520
|
+
}
|