@sprucelabs/spruce-cli 15.2.0 → 15.2.4
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 +32 -0
- package/build/__tests__/behavioral/AddingADependency.test.js +3 -3
- package/build/__tests__/behavioral/BlockingCommands.test.js +3 -3
- package/build/__tests__/behavioral/DeployingASkill.test.js +3 -3
- package/build/__tests__/behavioral/DeployingToSandbox.test.js +3 -3
- package/build/__tests__/behavioral/ListeningToCoreEvents.test.js +3 -3
- package/build/__tests__/behavioral/LoggingInAsASkill.test.js +3 -3
- package/build/__tests__/behavioral/ManagingDependencies.test.js +3 -3
- package/build/__tests__/behavioral/OverridingCommandsInPackageJson.test.js +3 -3
- package/build/__tests__/behavioral/RebuildingASkill.test.js +3 -3
- package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js +3 -3
- package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js +3 -3
- package/build/__tests__/behavioral/RememberingUpgradeSelections.test.js +3 -3
- package/build/__tests__/behavioral/SettingLogTransportsInASkill.test.js +3 -3
- package/build/__tests__/behavioral/SettingRemote.test.js +3 -3
- package/build/__tests__/behavioral/SettingUpASkillForTesting.test.js +3 -3
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js +3 -3
- package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js +3 -3
- package/build/__tests__/behavioral/TestingDataStores.test.js +3 -3
- package/build/__tests__/behavioral/UpdatingDependencies.test.js +3 -3
- package/build/__tests__/behavioral/UpdatingDependencies2.test.js +3 -3
- package/build/__tests__/behavioral/WatchingSkillViews.test.js +3 -3
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +3 -3
- package/build/__tests__/behavioral/events/CreatingAListener.test.js +3 -3
- package/build/__tests__/behavioral/events/CreatingAnEvent.test.js +3 -3
- package/build/__tests__/behavioral/events/KeepingEventsInSync2.test.js +3 -3
- package/build/__tests__/behavioral/schemas/KeepingSchemasInSync.test.js +3 -3
- package/build/__tests__/behavioral/skill/BootingASkill.test.js +3 -3
- package/build/__tests__/behavioral/skill/UpgradingASkill2.test.js +3 -3
- package/build/__tests__/behavioral/stores/CreatingADataStore.test.js +3 -3
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js +3 -3
- package/build/__tests__/behavioral/tests/CreatingATest.test.d.ts +1 -1
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +72 -78
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.d.ts +5 -0
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js +331 -160
- package/build/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.js.map +1 -1
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +3 -3
- package/build/__tests__/behavioral/views/CreatingATheme.test.js +3 -3
- package/build/__tests__/behavioral/views/KeepingViewsInSync.test.js +3 -3
- package/build/__tests__/behavioral/views/TestingViewControllers.test.js +3 -3
- package/build/__tests__/implementation/BulkImporting.test.js +3 -3
- package/build/__tests__/implementation/CachingImports.test.js +3 -3
- package/build/__tests__/implementation/CommanderCommandResultMapper.test.js +3 -3
- package/build/__tests__/implementation/DataStoreStore.test.js +3 -3
- package/build/__tests__/implementation/EventStore.test.js +3 -3
- package/build/__tests__/implementation/EventTemplateItemBuilder.test.js +3 -3
- package/build/__tests__/implementation/FeatureCommandAttacher.test.js +3 -3
- package/build/__tests__/implementation/FeatureFixture.test.js +3 -3
- package/build/__tests__/implementation/FeatureInstaller.test.js +3 -3
- package/build/__tests__/implementation/FieldTemplateItemBuilder.test.js +3 -3
- package/build/__tests__/implementation/JestJsonParser.test.js +3 -3
- package/build/__tests__/implementation/OnboardingScriptLoader.test.js +3 -3
- package/build/__tests__/implementation/OnboardingScriptPlayer.test.js +3 -3
- package/build/__tests__/implementation/OnboardingStore.test.js +3 -3
- package/build/__tests__/implementation/PkgService.test.js +3 -3
- package/build/__tests__/implementation/SchemaTemplateItemBuilder.test.js +3 -3
- package/build/__tests__/implementation/SchemaValueTypeWriter.test.js +3 -3
- package/build/__tests__/implementation/ServiceFactory.test.js +3 -3
- package/build/__tests__/implementation/TestReporter.test.js +3 -3
- package/build/__tests__/implementation/TestRunner.test.js +3 -3
- package/build/__tests__/implementation/Widgets.test.js +3 -3
- package/build/features/test/actions/CreateAction.js +6 -6
- package/build/features/test/actions/CreateAction.js.map +1 -1
- package/package.json +27 -27
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +16 -21
- package/src/__tests__/behavioral/tests/SelectingAnAbstractTestClass.test.ts +62 -23
- package/src/features/test/actions/CreateAction.ts +7 -7
|
@@ -27,17 +27,7 @@ const featuresWithRegisteredTests: {
|
|
|
27
27
|
export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
|
|
28
28
|
@test()
|
|
29
29
|
protected static async asksForYouToSelectABaseClass() {
|
|
30
|
-
await this.
|
|
31
|
-
await this.copyTestFiles()
|
|
32
|
-
|
|
33
|
-
const { choices, promise } =
|
|
34
|
-
await this.executeCreateUntilAbstractClassSelection()
|
|
35
|
-
|
|
36
|
-
for (const expected of expectedAbstractTests) {
|
|
37
|
-
assert.doesInclude(choices, { label: expected })
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
this.selectOptionBasedOnLabel('AbstractBananaTestDifferentThanFileName')
|
|
30
|
+
const { promise } = await this.installCopyTestFilesSelectLocalAbstractTest()
|
|
41
31
|
|
|
42
32
|
const results = await promise
|
|
43
33
|
|
|
@@ -46,12 +36,27 @@ export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
|
|
|
46
36
|
results.files
|
|
47
37
|
)
|
|
48
38
|
|
|
49
|
-
await this.
|
|
39
|
+
await this.buildAndAssertTestFailsAsExpected()
|
|
40
|
+
}
|
|
50
41
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)
|
|
42
|
+
@test()
|
|
43
|
+
protected static async canSelectAbstractClassWhileSelectingSubDir() {
|
|
44
|
+
const testDir = this.resolvePath('src', '__tests__', 'behavioral', 'taco')
|
|
45
|
+
diskUtil.createDir(testDir)
|
|
46
|
+
|
|
47
|
+
await this.installAndCopyTestFiles()
|
|
48
|
+
|
|
49
|
+
const { promise } = await this.invokeCreateActionAndWaitForInput()
|
|
50
|
+
|
|
51
|
+
await this.ui.sendInput('taco')
|
|
52
|
+
|
|
53
|
+
await this.waitForInput()
|
|
54
|
+
|
|
55
|
+
this.selectOptionBasedOnLabel('AbstractBananaTestDifferentThanFileName')
|
|
56
|
+
|
|
57
|
+
await promise
|
|
58
|
+
|
|
59
|
+
await this.buildAndAssertTestFailsAsExpected()
|
|
55
60
|
}
|
|
56
61
|
|
|
57
62
|
@test()
|
|
@@ -169,6 +174,35 @@ export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
|
|
|
169
174
|
}
|
|
170
175
|
}
|
|
171
176
|
|
|
177
|
+
private static async buildAndAssertTestFailsAsExpected() {
|
|
178
|
+
await this.Service('build').build()
|
|
179
|
+
|
|
180
|
+
await assert.doesThrowAsync(
|
|
181
|
+
() => this.Service('command').execute('yarn test'),
|
|
182
|
+
/false.*?does not equal.*?true/gis
|
|
183
|
+
)
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
private static async installCopyTestFilesSelectLocalAbstractTest() {
|
|
187
|
+
await this.installAndCopyTestFiles()
|
|
188
|
+
|
|
189
|
+
const { choices, promise } =
|
|
190
|
+
await this.executeCreateUntilAbstractClassSelection()
|
|
191
|
+
|
|
192
|
+
for (const expected of expectedAbstractTests) {
|
|
193
|
+
assert.doesInclude(choices, { label: expected })
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
this.selectOptionBasedOnLabel('AbstractBananaTestDifferentThanFileName')
|
|
197
|
+
|
|
198
|
+
return { promise }
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
private static async installAndCopyTestFiles() {
|
|
202
|
+
await this.installTests()
|
|
203
|
+
await this.copyTestFiles()
|
|
204
|
+
}
|
|
205
|
+
|
|
172
206
|
private static async copyTestFiles() {
|
|
173
207
|
const source = this.resolveTestPath('abstract_tests')
|
|
174
208
|
const destination = this.resolvePath('src')
|
|
@@ -177,13 +211,7 @@ export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
|
|
|
177
211
|
}
|
|
178
212
|
|
|
179
213
|
private static async executeCreateUntilAbstractClassSelection() {
|
|
180
|
-
const promise = this.
|
|
181
|
-
type: 'behavioral',
|
|
182
|
-
nameReadable: 'Can book appointment',
|
|
183
|
-
nameCamel: 'canBookAppointment',
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
await this.waitForInput()
|
|
214
|
+
const { promise } = await this.invokeCreateActionAndWaitForInput()
|
|
187
215
|
|
|
188
216
|
const last = this.ui.getLastInvocation()
|
|
189
217
|
const { choices } = last.options.options ?? {}
|
|
@@ -193,4 +221,15 @@ export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
|
|
|
193
221
|
choices: SelectChoice[]
|
|
194
222
|
}
|
|
195
223
|
}
|
|
224
|
+
|
|
225
|
+
private static async invokeCreateActionAndWaitForInput() {
|
|
226
|
+
const promise = this.Action('test', 'create').execute({
|
|
227
|
+
type: 'behavioral',
|
|
228
|
+
nameReadable: 'Can book appointment',
|
|
229
|
+
nameCamel: 'canBookAppointment',
|
|
230
|
+
})
|
|
231
|
+
|
|
232
|
+
await this.waitForInput()
|
|
233
|
+
return { promise }
|
|
234
|
+
}
|
|
196
235
|
}
|
|
@@ -37,6 +37,13 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
|
|
|
37
37
|
|
|
38
38
|
const candidates = await testFeature.buildParentClassCandidates()
|
|
39
39
|
|
|
40
|
+
if (diskUtil.doesDirExist(resolvedDestination)) {
|
|
41
|
+
resolvedDestination = await this.promptForSubDir(
|
|
42
|
+
resolvedDestination,
|
|
43
|
+
type
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
if (candidates.length > 0) {
|
|
41
48
|
parentTestClass =
|
|
42
49
|
await this.promptForParentTestClassAndOptionallyInstallDependencies(
|
|
@@ -46,13 +53,6 @@ export default class CreateAction extends AbstractAction<OptionsSchema> {
|
|
|
46
53
|
)
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
if (diskUtil.doesDirExist(resolvedDestination)) {
|
|
50
|
-
resolvedDestination = await this.promptForSubDir(
|
|
51
|
-
resolvedDestination,
|
|
52
|
-
type
|
|
53
|
-
)
|
|
54
|
-
}
|
|
55
|
-
|
|
56
56
|
this.ui.startLoading('Generating test file...')
|
|
57
57
|
|
|
58
58
|
const writer = this.Writer('test')
|