@sprucelabs/spruce-cli 18.2.0 → 18.3.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.
- package/CHANGELOG.md +6 -0
- package/build/.spruce/events/events.contract.d.ts +159 -0
- package/build/.spruce/events/events.contract.js +5 -1
- package/build/.spruce/events/events.contract.js.map +1 -1
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.d.ts +46 -0
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js +57 -0
- package/build/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.d.ts +68 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js +78 -0
- package/build/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.d.ts +40 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js +51 -0
- package/build/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.js.map +1 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.d.ts +9 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js +17 -0
- package/build/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.js.map +1 -0
- package/build/.spruce/schemas/schemas.types.d.ts +158 -55
- package/build/.spruce/schemas/schemas.types.js.map +1 -1
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.d.ts +3 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js +70 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.js.map +1 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.d.ts +3 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js +35 -0
- package/build/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.js.map +1 -0
- package/build/.spruce/settings.json +2 -1
- package/build/GlobalEmitter.d.ts +13 -38
- package/build/GlobalEmitter.js +3 -6
- package/build/GlobalEmitter.js.map +1 -1
- package/build/__tests__/behavioral/TestingAConversation.test.d.ts +2 -1
- package/build/__tests__/behavioral/TestingAConversation.test.js +74 -84
- package/build/__tests__/behavioral/TestingAConversation.test.js.map +1 -1
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +38 -13
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.d.ts +1 -0
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js +16 -9
- package/build/__tests__/behavioral/events/SkillEmitsBootEvents.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.d.ts +2 -2
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js +7 -7
- package/build/__tests__/behavioral/permissions/CreatingPermissions.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.d.ts +6 -0
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js +85 -0
- package/build/__tests__/behavioral/permissions/PermissionPlugin.test.js.map +1 -0
- package/build/__tests__/behavioral/permissions/PermissionStore.test.d.ts +5 -4
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js +96 -63
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.d.ts +5 -0
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.js +88 -0
- package/build/__tests__/behavioral/permissions/PermissionWriter.test.js.map +1 -0
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.d.ts +15 -4
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js +325 -28
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.d.ts +11 -0
- package/build/__tests__/behavioral/permissions/{AbstractPermissionsTest.js → support/AbstractPermissionsTest.js} +34 -2
- package/build/__tests__/behavioral/permissions/support/AbstractPermissionsTest.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.d.ts +1 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js +11 -0
- package/build/__tests__/behavioral/permissions/support/generateShortAlphaId.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.d.ts +1 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js +17 -0
- package/build/__tests__/behavioral/permissions/support/renderPermissionTestFile.js.map +1 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.d.ts +5 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js +10 -0
- package/build/__tests__/behavioral/permissions/support/sortPermissionContracts.js.map +1 -0
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.d.ts +1 -1
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js +46 -46
- package/build/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.js.map +1 -1
- package/build/__tests__/behavioral/tests/CreatingATest.test.js +2 -2
- package/build/__tests__/behavioral/tests/CreatingATest.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js +7 -3
- package/build/__tests__/behavioral/upgrading/UpgradingANodeModule.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js +2 -2
- package/build/__tests__/behavioral/upgrading/UpgradingASkill3.test.js.map +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js +1 -1
- package/build/__tests__/behavioral/upgrading/UpgradingASkill4.test.js.map +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.d.ts +1 -1
- package/build/__tests__/implementation/ActionExecuter2.test.js +23 -11
- package/build/__tests__/implementation/ActionExecuter2.test.js.map +1 -1
- package/build/__tests__/implementation/GlobalEmitter.test.d.ts +1 -0
- package/build/__tests__/implementation/GlobalEmitter.test.js +40 -3
- package/build/__tests__/implementation/GlobalEmitter.test.js.map +1 -1
- package/build/__tests__/implementation/SkillStore.test.js +3 -4
- package/build/__tests__/implementation/SkillStore.test.js.map +1 -1
- package/build/features/AbstractAction.d.ts +1 -1
- package/build/features/AbstractAction.js.map +1 -1
- package/build/features/AbstractFeature.d.ts +3 -3
- package/build/features/AbstractFeature.js +8 -8
- package/build/features/AbstractFeature.js.map +1 -1
- package/build/features/ActionExecuter.d.ts +1 -1
- package/build/features/ActionExecuter.js +3 -4
- package/build/features/ActionExecuter.js.map +1 -1
- package/build/features/ActionFactory.d.ts +12 -5
- package/build/features/ActionFactory.js +27 -6
- package/build/features/ActionFactory.js.map +1 -1
- package/build/features/ActionQuestionAsker.d.ts +1 -1
- package/build/features/ActionQuestionAsker.js +6 -6
- package/build/features/ActionQuestionAsker.js.map +1 -1
- package/build/features/conversation/ConversationFeature.js +1 -1
- package/build/features/conversation/ConversationFeature.js.map +1 -1
- package/build/features/dependencies/DependencyFeature.js +1 -1
- package/build/features/dependencies/DependencyFeature.js.map +1 -1
- package/build/features/deploy/actions/HerokuAction.js +31 -33
- package/build/features/deploy/actions/HerokuAction.js.map +1 -1
- package/build/features/error/ErrorFeature.js +4 -4
- package/build/features/error/ErrorFeature.js.map +1 -1
- package/build/features/event/EventFeature.d.ts +8 -8
- package/build/features/event/EventFeature.js +7 -4
- package/build/features/event/EventFeature.js.map +1 -1
- package/build/features/event/actions/CreateAction.js.map +1 -1
- package/build/features/event/actions/ListenAction.js.map +1 -1
- package/build/features/event/stores/EventStore.d.ts +9 -9
- package/build/features/event/stores/EventStore.js +26 -26
- package/build/features/event/stores/EventStore.js.map +1 -1
- package/build/features/eventContract/EventContractFeature.js +4 -1
- package/build/features/eventContract/EventContractFeature.js.map +1 -1
- package/build/features/eventContract/actions/PullAction.js +10 -5
- package/build/features/eventContract/actions/PullAction.js.map +1 -1
- package/build/features/features.types.d.ts +2 -37
- package/build/features/features.types.js +0 -41
- package/build/features/features.types.js.map +1 -1
- package/build/features/log/LogFeature.js +1 -1
- package/build/features/log/LogFeature.js.map +1 -1
- package/build/features/node/NodeFeature.js.map +1 -1
- package/build/features/organization/actions/InstallAction.js.map +1 -1
- package/build/features/permission/PermissionFeature.d.ts +12 -2
- package/build/features/permission/PermissionFeature.js +140 -15
- package/build/features/permission/PermissionFeature.js.map +1 -1
- package/build/features/permission/actions/CreateAction.js +4 -1
- package/build/features/permission/actions/CreateAction.js.map +1 -1
- package/build/features/permission/actions/SyncAction.d.ts +5 -1
- package/build/features/permission/actions/SyncAction.js +28 -10
- package/build/features/permission/actions/SyncAction.js.map +1 -1
- package/build/features/permission/stores/PermissionStore.d.ts +6 -1
- package/build/features/permission/stores/PermissionStore.js +43 -31
- package/build/features/permission/stores/PermissionStore.js.map +1 -1
- package/build/features/permission/writers/PermissionWriter.d.ts +7 -1
- package/build/features/permission/writers/PermissionWriter.js +66 -17
- package/build/features/permission/writers/PermissionWriter.js.map +1 -1
- package/build/features/person/PersonFeature.js +1 -1
- package/build/features/person/PersonFeature.js.map +1 -1
- package/build/features/sandbox/SandboxFeature.js +1 -1
- package/build/features/sandbox/SandboxFeature.js.map +1 -1
- package/build/features/schema/SchemaFeature.d.ts +8 -8
- package/build/features/schema/SchemaFeature.js +4 -4
- package/build/features/schema/SchemaFeature.js.map +1 -1
- package/build/features/schema/writers/SchemaWriter.d.ts +12 -12
- package/build/features/schema/writers/SchemaWriter.js.map +1 -1
- package/build/features/skill/SkillFeature.d.ts +11 -11
- package/build/features/skill/SkillFeature.js +2 -2
- package/build/features/skill/SkillFeature.js.map +1 -1
- package/build/features/skill/actions/RebuildAction.js.map +1 -1
- package/build/features/skill/actions/RegisterAction.js.map +1 -1
- package/build/features/skill/stores/SkillStore.js +1 -2
- package/build/features/skill/stores/SkillStore.js.map +1 -1
- package/build/features/store/StoreFeature.js +1 -1
- package/build/features/store/StoreFeature.js.map +1 -1
- package/build/features/store/actions/SyncAction.d.ts +1 -1
- package/build/features/store/actions/SyncAction.js.map +1 -1
- package/build/features/test/TestFeature.js +1 -1
- package/build/features/test/TestFeature.js.map +1 -1
- package/build/features/view/ViewFeature.js +1 -1
- package/build/features/view/ViewFeature.js.map +1 -1
- package/build/schemas/v2020_07_22/actionResponse.builder.d.ts +85 -0
- package/build/schemas/v2020_07_22/actionResponse.builder.js +70 -0
- package/build/schemas/v2020_07_22/actionResponse.builder.js.map +1 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.d.ts +27 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.js +45 -0
- package/build/schemas/v2020_07_22/generatedFile.builder.js.map +1 -0
- package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js +4 -40
- package/build/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.js.map +1 -1
- package/build/services/CommandService.d.ts +2 -2
- package/build/services/CommandService.js +6 -6
- package/build/services/CommandService.js.map +1 -1
- package/build/services/PkgService.d.ts +1 -0
- package/build/services/PkgService.js +5 -0
- package/build/services/PkgService.js.map +1 -1
- package/build/tests/AbstractCliTest.d.ts +7 -3
- package/build/tests/AbstractCliTest.js +81 -45
- package/build/tests/AbstractCliTest.js.map +1 -1
- package/build/tests/buildTestCache.js +7 -0
- package/build/tests/buildTestCache.js.map +1 -1
- package/build/tests/fixtures/FeatureFixture.js +1 -0
- package/build/tests/fixtures/FeatureFixture.js.map +1 -1
- package/build/tests/utilities/test.utility.d.ts +2 -0
- package/build/tests/utilities/test.utility.js +6 -0
- package/build/tests/utilities/test.utility.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts +4 -2
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js +13 -5
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/ClassVisitor.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts +2 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js +3 -0
- package/node_modules/@typescript-eslint/scope-manager/dist/referencer/Referencer.js.map +1 -1
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/_ts3.4/dist/generated/ast-spec.d.ts +20 -2
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts +20 -2
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js +2 -0
- package/node_modules/@typescript-eslint/types/dist/generated/ast-spec.js.map +1 -1
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/ts-estree/ts-nodes.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js +15 -3
- package/node_modules/@typescript-eslint/typescript-estree/dist/convert.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/estree-to-ts-node-types.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts +2 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/ts-estree/ts-nodes.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js +63 -49
- package/node_modules/@typescript-eslint/visitor-keys/dist/visitor-keys.js.map +1 -1
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +65 -33
- package/src/.spruce/events/events.contract.ts +24 -0
- package/src/.spruce/events/heartwood/getActiveTheme.v2021_02_11.contract.ts +54 -0
- package/src/.spruce/events/heartwood/registerDashboardCards.v2021_02_11.contract.ts +79 -0
- package/src/.spruce/events/heartwood/upsertTheme.v2021_02_11.contract.ts +48 -0
- package/src/.spruce/events/spruceCli/registerSkillViews.v2021_04_11.contract.ts +13 -0
- package/src/.spruce/schemas/schemas.types.ts +171 -52
- package/src/.spruce/schemas/spruceCli/v2020_07_22/actionResponse.schema.ts +58 -0
- package/src/.spruce/schemas/spruceCli/v2020_07_22/npmPackage.schema.ts +33 -0
- package/src/.spruce/settings.json +2 -1
- package/src/GlobalEmitter.ts +2 -7
- package/src/__tests__/behavioral/TestingAConversation.test.ts +20 -37
- package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +14 -2
- package/src/__tests__/behavioral/events/SkillEmitsBootEvents.test.ts +6 -0
- package/src/__tests__/behavioral/permissions/CreatingPermissions.test.ts +2 -2
- package/src/__tests__/behavioral/permissions/PermissionPlugin.test.ts +24 -0
- package/src/__tests__/behavioral/permissions/PermissionStore.test.ts +95 -38
- package/src/__tests__/behavioral/permissions/PermissionWriter.test.ts +23 -0
- package/src/__tests__/behavioral/permissions/SyncingPermissions.test.ts +125 -8
- package/src/__tests__/behavioral/permissions/support/AbstractPermissionsTest.ts +38 -0
- package/src/__tests__/behavioral/permissions/support/generateShortAlphaId.ts +5 -0
- package/src/__tests__/behavioral/permissions/support/renderPermissionTestFile.ts +27 -0
- package/src/__tests__/behavioral/permissions/support/sortPermissionContracts.ts +3 -0
- package/src/__tests__/behavioral/schemas/GettingSchemasFromHealthCheck.test.ts +12 -12
- package/src/__tests__/behavioral/tests/CreatingATest.test.ts +2 -2
- package/src/__tests__/behavioral/upgrading/UpgradingANodeModule.test.ts +3 -0
- package/src/__tests__/behavioral/upgrading/UpgradingASkill3.test.ts +3 -2
- package/src/__tests__/behavioral/upgrading/UpgradingASkill4.test.ts +1 -1
- package/src/__tests__/implementation/ActionExecuter2.test.ts +13 -6
- package/src/__tests__/implementation/GlobalEmitter.test.ts +22 -1
- package/src/__tests__/implementation/SkillStore.test.ts +1 -2
- package/src/features/AbstractAction.ts +2 -2
- package/src/features/AbstractFeature.ts +8 -8
- package/src/features/ActionExecuter.ts +4 -5
- package/src/features/ActionFactory.ts +44 -20
- package/src/features/ActionQuestionAsker.ts +17 -17
- package/src/features/conversation/ConversationFeature.ts +1 -1
- package/src/features/dependencies/DependencyFeature.ts +1 -1
- package/src/features/deploy/actions/HerokuAction.ts +2 -2
- package/src/features/error/ErrorFeature.ts +4 -4
- package/src/features/event/EventFeature.ts +15 -14
- package/src/features/event/actions/CreateAction.ts +1 -1
- package/src/features/event/actions/ListenAction.ts +1 -1
- package/src/features/event/stores/EventStore.ts +37 -37
- package/src/features/eventContract/EventContractFeature.ts +6 -1
- package/src/features/eventContract/actions/PullAction.ts +7 -3
- package/src/features/features.types.ts +4 -41
- package/src/features/log/LogFeature.ts +1 -1
- package/src/features/node/NodeFeature.ts +1 -1
- package/src/features/organization/actions/InstallAction.ts +1 -1
- package/src/features/permission/PermissionFeature.ts +66 -11
- package/src/features/permission/actions/CreateAction.ts +2 -0
- package/src/features/permission/actions/SyncAction.ts +22 -3
- package/src/features/permission/stores/PermissionStore.ts +27 -8
- package/src/features/permission/writers/PermissionWriter.ts +64 -3
- package/src/features/person/PersonFeature.ts +1 -1
- package/src/features/sandbox/SandboxFeature.ts +1 -3
- package/src/features/schema/SchemaFeature.ts +14 -14
- package/src/features/schema/writers/SchemaWriter.ts +14 -15
- package/src/features/skill/SkillFeature.ts +18 -18
- package/src/features/skill/actions/RebuildAction.ts +1 -1
- package/src/features/skill/actions/RegisterAction.ts +1 -1
- package/src/features/skill/stores/SkillStore.ts +1 -2
- package/src/features/store/StoreFeature.ts +1 -1
- package/src/features/store/actions/SyncAction.ts +1 -1
- package/src/features/test/TestFeature.ts +1 -1
- package/src/features/view/ViewFeature.ts +1 -1
- package/src/schemas/v2020_07_22/actionResponse.builder.ts +62 -0
- package/src/schemas/v2020_07_22/generatedFile.builder.ts +44 -0
- package/src/schemas/v2020_07_22/watcherDidDetectChangesEmitPayload.builder.ts +3 -46
- package/src/services/CommandService.ts +5 -5
- package/src/services/PkgService.ts +4 -0
- package/src/tests/AbstractCliTest.ts +31 -13
- package/src/tests/buildTestCache.ts +7 -0
- package/src/tests/fixtures/FeatureFixture.ts +2 -0
- package/src/tests/utilities/test.utility.ts +13 -0
- package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.d.ts +0 -8
- package/build/__tests__/behavioral/permissions/AbstractPermissionsTest.js.map +0 -1
- package/src/__tests__/behavioral/permissions/AbstractPermissionsTest.ts +0 -20
|
@@ -1,54 +1,84 @@
|
|
|
1
1
|
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
-
import {
|
|
2
|
+
import { SpruceSchemas } from '@sprucelabs/mercury-types'
|
|
3
3
|
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
4
4
|
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
5
|
-
import PermissionStore
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '
|
|
9
|
-
import
|
|
5
|
+
import PermissionStore, {
|
|
6
|
+
ImportedPermission,
|
|
7
|
+
} from '../../../features/permission/stores/PermissionStore'
|
|
8
|
+
import { ApiClientFactoryOptions } from '../../../types/apiClient.types'
|
|
9
|
+
import { ListPermContractsTargetAndPayload } from '../../support/EventFaker'
|
|
10
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
11
|
+
import generateShortAlphaId from './support/generateShortAlphaId'
|
|
12
|
+
import { sortPermissionContracts } from './support/sortPermissionContracts'
|
|
10
13
|
|
|
11
14
|
export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
12
|
-
protected static skillCacheKey = 'permissions'
|
|
13
15
|
private static permissions: PermissionStore
|
|
14
16
|
private static contractName1: string
|
|
15
17
|
private static contractName2: string
|
|
16
|
-
private static
|
|
18
|
+
private static fqid1: string
|
|
19
|
+
private static fqid2: string
|
|
20
|
+
private static namespace: string
|
|
17
21
|
|
|
18
22
|
protected static async beforeAll() {
|
|
19
23
|
await super.beforeAll()
|
|
24
|
+
const namespace = await this.Service('pkg').getSkillNamespace()
|
|
25
|
+
this.namespace = namespace
|
|
26
|
+
|
|
20
27
|
this.contractName1 = generateShortAlphaId()
|
|
28
|
+
this.fqid1 = `${namespace}.${this.contractName1}`
|
|
29
|
+
|
|
21
30
|
this.contractName2 = generateShortAlphaId()
|
|
31
|
+
const contractId = this.contractName2
|
|
32
|
+
this.fqid2 = buildPermissionContractId(contractId, namespace)
|
|
22
33
|
}
|
|
23
34
|
|
|
24
35
|
protected static async beforeEach() {
|
|
25
36
|
await super.beforeEach()
|
|
26
37
|
MercuryClientFactory.setIsTestMode(true)
|
|
27
38
|
this.permissions = this.Store('permission')
|
|
28
|
-
this.eventFaker
|
|
39
|
+
await this.eventFaker.fakeListPermissionContracts(() => {})
|
|
29
40
|
}
|
|
30
41
|
|
|
31
42
|
@test()
|
|
32
43
|
protected static async loadsNoLocalByDefault() {
|
|
33
44
|
const permissions = await this.loadLocalPermissions()
|
|
34
|
-
assert.isEqualDeep(permissions,
|
|
45
|
+
assert.isEqualDeep(permissions, [])
|
|
35
46
|
}
|
|
36
47
|
|
|
37
48
|
@test()
|
|
38
49
|
protected static async loadsOneContract() {
|
|
39
50
|
await this.createPermissionContract(this.contractName1)
|
|
40
|
-
await this.assertLocalPermissionsEqual(
|
|
41
|
-
|
|
42
|
-
|
|
51
|
+
await this.assertLocalPermissionsEqual([
|
|
52
|
+
{
|
|
53
|
+
id: this.fqid1,
|
|
54
|
+
permissions: ['can-high-five'],
|
|
55
|
+
path: this.resolvePath(
|
|
56
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
57
|
+
),
|
|
58
|
+
},
|
|
59
|
+
])
|
|
43
60
|
}
|
|
44
61
|
|
|
45
62
|
@test()
|
|
46
63
|
protected static async loadsSecondContract() {
|
|
47
64
|
await this.createPermissionContract(this.contractName2)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
|
|
66
|
+
await this.assertLocalPermissionsEqual([
|
|
67
|
+
{
|
|
68
|
+
id: this.fqid2,
|
|
69
|
+
permissions: ['can-high-five'],
|
|
70
|
+
path: this.resolvePath(
|
|
71
|
+
`src/permissions/${this.contractName2}.permissions.ts`
|
|
72
|
+
),
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
id: this.fqid1,
|
|
76
|
+
permissions: ['can-high-five'],
|
|
77
|
+
path: this.resolvePath(
|
|
78
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
79
|
+
),
|
|
80
|
+
},
|
|
81
|
+
])
|
|
52
82
|
}
|
|
53
83
|
|
|
54
84
|
@test()
|
|
@@ -59,22 +89,22 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
59
89
|
|
|
60
90
|
this.updateFirstContractBuilder(contractId, perm1Id, perm2Id)
|
|
61
91
|
|
|
62
|
-
await this.assertLocalPermissionsEqual(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
92
|
+
await this.assertLocalPermissionsEqual([
|
|
93
|
+
{
|
|
94
|
+
id: this.fqid2,
|
|
95
|
+
permissions: ['can-high-five'],
|
|
96
|
+
path: this.resolvePath(
|
|
97
|
+
`src/permissions/${this.contractName2}.permissions.ts`
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: buildPermissionContractId(contractId, this.namespace),
|
|
102
|
+
permissions: [perm1Id, perm2Id],
|
|
103
|
+
path: this.resolvePath(
|
|
104
|
+
`src/permissions/${this.contractName1}.permissions.ts`
|
|
105
|
+
),
|
|
106
|
+
},
|
|
107
|
+
])
|
|
78
108
|
}
|
|
79
109
|
|
|
80
110
|
@test()
|
|
@@ -116,11 +146,30 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
116
146
|
assert.isEqualDeep(map, {
|
|
117
147
|
[contractId]: [perm.id, perm2.id],
|
|
118
148
|
[contractId2]: [perm3.id],
|
|
119
|
-
[this.
|
|
120
|
-
'oeu-aoeuao': [
|
|
149
|
+
[this.fqid2]: ['can-high-five'],
|
|
150
|
+
[buildPermissionContractId('oeu-aoeuao', this.namespace)]: [
|
|
151
|
+
'what-the',
|
|
152
|
+
'go-dogs',
|
|
153
|
+
],
|
|
121
154
|
})
|
|
122
155
|
}
|
|
123
156
|
|
|
157
|
+
@test()
|
|
158
|
+
protected static async connectsAsSkill() {
|
|
159
|
+
let passedOptions: ApiClientFactoryOptions | undefined
|
|
160
|
+
|
|
161
|
+
//@ts-ignore
|
|
162
|
+
const old = this.permissions.connectToApi.bind(this.permissions)
|
|
163
|
+
//@ts-ignore
|
|
164
|
+
this.permissions.connectToApi = (options) => {
|
|
165
|
+
passedOptions = options
|
|
166
|
+
return old(passedOptions)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
await this.fetchContracts()
|
|
170
|
+
assert.isEqualDeep(passedOptions, { shouldAuthAsCurrentSkill: true })
|
|
171
|
+
}
|
|
172
|
+
|
|
124
173
|
private static updateFirstContractBuilder(
|
|
125
174
|
contractId: string,
|
|
126
175
|
perm1Id: string,
|
|
@@ -177,9 +226,13 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
177
226
|
}
|
|
178
227
|
|
|
179
228
|
private static async assertLocalPermissionsEqual(
|
|
180
|
-
expected:
|
|
229
|
+
expected: ImportedPermission[]
|
|
181
230
|
) {
|
|
182
231
|
const perms = await this.loadLocalPermissions()
|
|
232
|
+
|
|
233
|
+
perms.sort(sortPermissionContracts)
|
|
234
|
+
expected.sort(sortPermissionContracts)
|
|
235
|
+
|
|
183
236
|
assert.isEqualDeep(perms, expected)
|
|
184
237
|
}
|
|
185
238
|
|
|
@@ -188,8 +241,12 @@ export default class PermissionStoreTest extends AbstractPermissionsTest {
|
|
|
188
241
|
return await this.permissions.loadLocalPermissions()
|
|
189
242
|
}
|
|
190
243
|
}
|
|
191
|
-
|
|
192
|
-
|
|
244
|
+
|
|
245
|
+
function buildPermissionContractId(
|
|
246
|
+
contractId: string,
|
|
247
|
+
namespace?: string
|
|
248
|
+
): string {
|
|
249
|
+
return `${namespace}.${contractId}`
|
|
193
250
|
}
|
|
194
251
|
|
|
195
252
|
function generateContractBuilder(
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { PermissionContractMap } from '@sprucelabs/mercury-types'
|
|
2
|
+
import { test, generateId } from '@sprucelabs/test-utils'
|
|
3
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
4
|
+
|
|
5
|
+
export default class PermissionWriterTest extends AbstractPermissionsTest {
|
|
6
|
+
@test()
|
|
7
|
+
protected static async writesProperContractId() {
|
|
8
|
+
const contractId = generateId()
|
|
9
|
+
const perm1 = generateId()
|
|
10
|
+
const perm2 = generateId()
|
|
11
|
+
|
|
12
|
+
await this.writeTypesFile({
|
|
13
|
+
[contractId]: [perm1, perm2],
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
await this.writeTestFileAndAssertValid(contractId, perm1, perm2)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
private static async writeTypesFile(map: PermissionContractMap) {
|
|
20
|
+
const writer = this.writers.Writer('permission', { fileDescriptions: [] })
|
|
21
|
+
await writer.writeTypesFile(this.cwd, map)
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -1,25 +1,142 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { MercuryClientFactory } from '@sprucelabs/mercury-client'
|
|
2
|
+
import { diskUtil } from '@sprucelabs/spruce-skill-utils'
|
|
3
|
+
import { assert, test } from '@sprucelabs/test-utils'
|
|
4
|
+
import ActionFactory from '../../../features/ActionFactory'
|
|
2
5
|
import SyncAction from '../../../features/permission/actions/SyncAction'
|
|
3
|
-
import AbstractSkillTest from '../../../tests/AbstractSkillTest'
|
|
4
6
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
7
|
+
import AbstractPermissionsTest from './support/AbstractPermissionsTest'
|
|
8
|
+
import generateShortAlphaId from './support/generateShortAlphaId'
|
|
9
|
+
import { sortPermissionContracts } from './support/sortPermissionContracts'
|
|
5
10
|
|
|
6
|
-
export default class SyncingPermissionsTest extends
|
|
7
|
-
|
|
8
|
-
private static
|
|
11
|
+
export default class SyncingPermissionsTest extends AbstractPermissionsTest {
|
|
12
|
+
private static syncAction: SyncAction
|
|
13
|
+
private static contractId1: string
|
|
14
|
+
private static contractId2: string
|
|
15
|
+
|
|
16
|
+
protected static async beforeAll() {
|
|
17
|
+
await super.beforeAll()
|
|
18
|
+
this.contractId1 = generateShortAlphaId()
|
|
19
|
+
this.contractId2 = generateShortAlphaId()
|
|
20
|
+
}
|
|
9
21
|
|
|
10
22
|
protected static async beforeEach() {
|
|
11
23
|
await super.beforeEach()
|
|
12
|
-
this.
|
|
24
|
+
this.syncAction = this.Action('permission', 'sync')
|
|
25
|
+
MercuryClientFactory.setIsTestMode(true)
|
|
26
|
+
ExecuteTrackingAction.wasExecuteInvoked = false
|
|
27
|
+
await this.eventFaker.fakeListPermissionContracts()
|
|
13
28
|
}
|
|
14
29
|
|
|
15
30
|
@test()
|
|
16
31
|
protected static async generatesExpectedTypesFile() {
|
|
17
|
-
const results = await this.sync
|
|
32
|
+
const results = await this.sync()
|
|
33
|
+
|
|
18
34
|
const expected = this.resolveHashSprucePath(
|
|
19
35
|
`permissions/permissions.types.ts`
|
|
20
36
|
)
|
|
21
37
|
|
|
22
38
|
testUtil.assertFileByPathInGeneratedFiles(expected, results.files)
|
|
23
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@test()
|
|
42
|
+
protected static async syncsNewPermissionsWhenMade() {
|
|
43
|
+
await this.createPermissionContract(this.contractId1)
|
|
44
|
+
await this.writeTestFileAndAssertValid(
|
|
45
|
+
`testing-permissions.${this.contractId1}`
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@test()
|
|
50
|
+
protected static async upgradingSyncsPermissions() {
|
|
51
|
+
this.beginTrackingExecute()
|
|
52
|
+
await this.emitDidExecuteUpgrade()
|
|
53
|
+
assert.isTrue(ExecuteTrackingAction.wasExecuteInvoked)
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@test()
|
|
57
|
+
protected static async doesNotSyncIfNotInstalled() {
|
|
58
|
+
this.beginTrackingExecute()
|
|
59
|
+
this.featureInstaller.isInstalled = async (code) => code === 'node'
|
|
60
|
+
|
|
61
|
+
await this.emitDidExecuteUpgrade()
|
|
62
|
+
assert.isFalse(ExecuteTrackingAction.wasExecuteInvoked)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@test()
|
|
66
|
+
protected static async generatesCombinedFile() {
|
|
67
|
+
assert.isTrue(diskUtil.doesFileExist(this.getCombinedPath()))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@test()
|
|
71
|
+
protected static async combinedFileImportsAllPermissions() {
|
|
72
|
+
await this.createPermissionContract(this.contractId2)
|
|
73
|
+
|
|
74
|
+
const imported = await this.Service('import').importDefault(
|
|
75
|
+
this.getCombinedPath()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
assert.isEqualDeep(
|
|
79
|
+
imported.sort(sortPermissionContracts),
|
|
80
|
+
[
|
|
81
|
+
{
|
|
82
|
+
id: this.contractId1,
|
|
83
|
+
name: this.contractId1,
|
|
84
|
+
description: '',
|
|
85
|
+
requireAllPermissions: false,
|
|
86
|
+
permissions: [
|
|
87
|
+
{
|
|
88
|
+
id: 'can-high-five',
|
|
89
|
+
name: 'Can give high five',
|
|
90
|
+
description: 'Will this person be allowed to high five?',
|
|
91
|
+
defaults: { skill: false },
|
|
92
|
+
requireAllStatuses: false,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
id: this.contractId2,
|
|
98
|
+
name: this.contractId2,
|
|
99
|
+
description: '',
|
|
100
|
+
requireAllPermissions: false,
|
|
101
|
+
permissions: [
|
|
102
|
+
{
|
|
103
|
+
id: 'can-high-five',
|
|
104
|
+
name: 'Can give high five',
|
|
105
|
+
description: 'Will this person be allowed to high five?',
|
|
106
|
+
defaults: { skill: false },
|
|
107
|
+
requireAllStatuses: false,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
},
|
|
111
|
+
].sort(sortPermissionContracts)
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
private static getCombinedPath() {
|
|
116
|
+
return this.resolveHashSprucePath('permissions', 'permissions.ts')
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private static beginTrackingExecute() {
|
|
120
|
+
ActionFactory.setActionClass('permission', 'sync', ExecuteTrackingAction)
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
private static async sync() {
|
|
124
|
+
return await this.syncAction.execute()
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
private static async emitDidExecuteUpgrade() {
|
|
128
|
+
await this.emitter.emitAndFlattenResponses('feature.did-execute', {
|
|
129
|
+
actionCode: 'upgrade',
|
|
130
|
+
featureCode: 'node',
|
|
131
|
+
results: {},
|
|
132
|
+
})
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
class ExecuteTrackingAction extends SyncAction {
|
|
137
|
+
public static wasExecuteInvoked = false
|
|
138
|
+
public async execute() {
|
|
139
|
+
ExecuteTrackingAction.wasExecuteInvoked = true
|
|
140
|
+
return {}
|
|
24
141
|
}
|
|
25
142
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'
|
|
2
|
+
import CreateAction from '../../../../features/permission/actions/CreateAction'
|
|
3
|
+
import AbstractSkillTest from '../../../../tests/AbstractSkillTest'
|
|
4
|
+
import EventFaker from '../../../support/EventFaker'
|
|
5
|
+
import renderPermissionTestFile from './renderPermissionTestFile'
|
|
6
|
+
|
|
7
|
+
export default abstract class AbstractPermissionsTest extends AbstractSkillTest {
|
|
8
|
+
protected static skillCacheKey = 'permissions'
|
|
9
|
+
protected static createAction: CreateAction
|
|
10
|
+
protected static eventFaker: EventFaker
|
|
11
|
+
|
|
12
|
+
protected static async beforeEach() {
|
|
13
|
+
await super.beforeEach()
|
|
14
|
+
this.createAction = this.Action('permission', 'create')
|
|
15
|
+
this.eventFaker = new EventFaker()
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
protected static async createPermissionContract(nameReadable: string) {
|
|
19
|
+
return await this.createAction.execute({
|
|
20
|
+
nameReadable,
|
|
21
|
+
nameCamel: namesUtil.toCamel(nameReadable),
|
|
22
|
+
})
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
protected static async writeTestFileAndAssertValid(
|
|
26
|
+
contractId: string,
|
|
27
|
+
perm1?: string,
|
|
28
|
+
perm2?: string
|
|
29
|
+
) {
|
|
30
|
+
const contents = renderPermissionTestFile(contractId, perm1, perm2)
|
|
31
|
+
const destination = this.resolvePath('src', 'test.ts')
|
|
32
|
+
diskUtil.writeFile(destination, contents)
|
|
33
|
+
|
|
34
|
+
await this.assertFilePassesTypeChecks(destination)
|
|
35
|
+
|
|
36
|
+
return destination
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export default function renderPermissionTestFile(
|
|
2
|
+
contractId: string,
|
|
3
|
+
perm1?: string,
|
|
4
|
+
perm2?: string
|
|
5
|
+
) {
|
|
6
|
+
const parts = [
|
|
7
|
+
`import '${'#' + 'spruce/permissions/permissions.types'}'
|
|
8
|
+
import { PermissionContractId${
|
|
9
|
+
perm1 ? ', PermissionId' : ''
|
|
10
|
+
} } from '@sprucelabs/mercury-types'
|
|
11
|
+
|
|
12
|
+
const contractId: PermissionContractId = '${contractId}'
|
|
13
|
+
console.log(contractId)`,
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
if (perm1) {
|
|
17
|
+
parts.push(`const perm1: PermissionId<'${contractId}'> = '${perm1}'
|
|
18
|
+
console.log(perm1)`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (perm2) {
|
|
22
|
+
parts.push(`const perm2: PermissionId<'${contractId}'> = '${perm2}'
|
|
23
|
+
console.log(perm2)`)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return parts.join('\n')
|
|
27
|
+
}
|
|
@@ -17,18 +17,6 @@ export default class GettingSchemasFromHealthCheckTest extends AbstractSchemaTes
|
|
|
17
17
|
await this.assertExpectedSchemas(cli, cleanedExpected)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
private static async assertExpectedSchemas(
|
|
21
|
-
cli: CliInterface,
|
|
22
|
-
expected: Schema[]
|
|
23
|
-
) {
|
|
24
|
-
const health = await cli.checkHealth()
|
|
25
|
-
assert.isFalsy(health.skill.errors)
|
|
26
|
-
assert.isTruthy(health.schema)
|
|
27
|
-
assert.isEqual(health.schema.status, 'passed')
|
|
28
|
-
|
|
29
|
-
assert.isEqualDeep(this.sortSchemas(health.schema.schemas), expected)
|
|
30
|
-
}
|
|
31
|
-
|
|
32
20
|
@test()
|
|
33
21
|
protected static async getsCoreAndLocalSchemasFromHealthCheck() {
|
|
34
22
|
const cli = await this.installAndSyncSchemas()
|
|
@@ -60,4 +48,16 @@ export default class GettingSchemasFromHealthCheckTest extends AbstractSchemaTes
|
|
|
60
48
|
await this.Action('schema', 'sync').execute({})
|
|
61
49
|
return cli
|
|
62
50
|
}
|
|
51
|
+
|
|
52
|
+
private static async assertExpectedSchemas(
|
|
53
|
+
cli: CliInterface,
|
|
54
|
+
expected: Schema[]
|
|
55
|
+
) {
|
|
56
|
+
const health = await cli.checkHealth()
|
|
57
|
+
assert.isFalsy(health.skill.errors)
|
|
58
|
+
assert.isTruthy(health.schema)
|
|
59
|
+
assert.isEqual(health.schema.status, 'passed')
|
|
60
|
+
|
|
61
|
+
assert.isEqualDeep(this.sortSchemas(health.schema.schemas), expected)
|
|
62
|
+
}
|
|
63
63
|
}
|
|
@@ -19,8 +19,8 @@ export default class CreatingBehavioralTestsTest extends AbstractTestTest {
|
|
|
19
19
|
const candidates = await testFeature.buildParentClassCandidates()
|
|
20
20
|
|
|
21
21
|
assert.doesInclude(candidates, {
|
|
22
|
-
label: '
|
|
23
|
-
name: '
|
|
22
|
+
label: 'AbstractStoreTest (requires install)',
|
|
23
|
+
name: 'AbstractStoreTest',
|
|
24
24
|
})
|
|
25
25
|
}
|
|
26
26
|
|
|
@@ -33,7 +33,10 @@ export default class UpgradingANodeModuleTest extends AbstractCliTest {
|
|
|
33
33
|
|
|
34
34
|
@test()
|
|
35
35
|
protected static async upgradingWritesExpectedFiles() {
|
|
36
|
+
CommandService.fakeCommand(/build/gis, { code: 0 })
|
|
37
|
+
|
|
36
38
|
const shouldNotBeFound = ['src/.spruce/skill.ts', 'src/.spruce/features']
|
|
39
|
+
diskUtil.deleteDir(this.resolveHashSprucePath('features'))
|
|
37
40
|
|
|
38
41
|
const results = await this.Action('node', 'upgrade').execute({})
|
|
39
42
|
|
|
@@ -8,6 +8,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
|
8
8
|
import testUtil from '../../../tests/utilities/test.utility'
|
|
9
9
|
export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
10
10
|
private static originalErrorSyncExecute: any
|
|
11
|
+
|
|
11
12
|
protected static async beforeEach() {
|
|
12
13
|
if (!this.originalErrorSyncExecute) {
|
|
13
14
|
this.originalErrorSyncExecute = SyncAction.prototype.execute
|
|
@@ -23,7 +24,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
23
24
|
|
|
24
25
|
@test()
|
|
25
26
|
protected static async doesNotAddResolvePathAliasesToDependenciesAfterUpgrade() {
|
|
26
|
-
CommandService.
|
|
27
|
+
CommandService.clearFakedResponses()
|
|
27
28
|
await this.FeatureFixture().installCachedFeatures('views')
|
|
28
29
|
|
|
29
30
|
await this.Action('node', 'upgrade').execute({})
|
|
@@ -35,7 +36,7 @@ export default class UpgradingASkill3Test extends AbstractCliTest {
|
|
|
35
36
|
|
|
36
37
|
@test()
|
|
37
38
|
protected static async featuresNotEnabledDontInstall() {
|
|
38
|
-
CommandService.
|
|
39
|
+
CommandService.clearFakedResponses()
|
|
39
40
|
await this.FeatureFixture().installCachedFeatures('schemas')
|
|
40
41
|
|
|
41
42
|
const results = await this.Action('node', 'upgrade').execute({})
|
|
@@ -7,7 +7,7 @@ import AbstractCliTest from '../../../tests/AbstractCliTest'
|
|
|
7
7
|
export default class UpgradingASkill4Test extends AbstractCliTest {
|
|
8
8
|
protected static async beforeEach() {
|
|
9
9
|
await super.beforeEach()
|
|
10
|
-
CommandService.fakeCommand(new RegExp(/
|
|
10
|
+
CommandService.fakeCommand(new RegExp(/rebuild/gis), {
|
|
11
11
|
code: 0,
|
|
12
12
|
})
|
|
13
13
|
}
|
|
@@ -31,7 +31,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
31
31
|
|
|
32
32
|
@test()
|
|
33
33
|
protected static async shouldEmitExecutionEvents() {
|
|
34
|
-
this.
|
|
34
|
+
this.fakeInstallCommands()
|
|
35
35
|
|
|
36
36
|
const executer = this.Action('skill', 'create', {
|
|
37
37
|
shouldAutoHandleDependencies: true,
|
|
@@ -129,7 +129,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
129
129
|
|
|
130
130
|
@test()
|
|
131
131
|
protected static async shouldReturnProperSummary() {
|
|
132
|
-
this.
|
|
132
|
+
this.fakeInstallCommands()
|
|
133
133
|
|
|
134
134
|
const executer = this.Action('skill', 'create', {
|
|
135
135
|
shouldAutoHandleDependencies: true,
|
|
@@ -148,7 +148,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
148
148
|
|
|
149
149
|
@test()
|
|
150
150
|
protected static async shouldAskInstallDependentFeatures() {
|
|
151
|
-
this.
|
|
151
|
+
this.fakeInstallCommands()
|
|
152
152
|
|
|
153
153
|
const executer = this.Action('schema', 'create', {
|
|
154
154
|
shouldAutoHandleDependencies: true,
|
|
@@ -169,7 +169,7 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
169
169
|
|
|
170
170
|
@test()
|
|
171
171
|
protected static async shouldAddListenerWithoutBreakingOnSkill() {
|
|
172
|
-
this.
|
|
172
|
+
this.fakeInstallCommands()
|
|
173
173
|
|
|
174
174
|
await this.FeatureFixture().installCachedFeatures('schemas')
|
|
175
175
|
|
|
@@ -180,7 +180,14 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
180
180
|
|
|
181
181
|
await this.waitForInput()
|
|
182
182
|
|
|
183
|
+
await this.ui.sendInput('Y')
|
|
184
|
+
await this.waitForInput()
|
|
185
|
+
await this.ui.sendInput('\n')
|
|
186
|
+
|
|
187
|
+
await this.waitForInput()
|
|
188
|
+
|
|
183
189
|
await this.ui.sendInput('skill')
|
|
190
|
+
|
|
184
191
|
await this.ui.sendInput('will-boot')
|
|
185
192
|
|
|
186
193
|
const results = await promise
|
|
@@ -264,8 +271,8 @@ export default class FeatureCommandExecuterContTest extends AbstractSchemaTest {
|
|
|
264
271
|
return { promise }
|
|
265
272
|
}
|
|
266
273
|
|
|
267
|
-
private static
|
|
268
|
-
CommandService.fakeCommand(new RegExp(/npm
|
|
274
|
+
private static fakeInstallCommands() {
|
|
275
|
+
CommandService.fakeCommand(new RegExp(/yarn|npm/gis), {
|
|
269
276
|
code: 0,
|
|
270
277
|
})
|
|
271
278
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { test, assert } from '@sprucelabs/test-utils'
|
|
1
|
+
import { test, assert, generateId } from '@sprucelabs/test-utils'
|
|
2
2
|
import AbstractCliTest from '../../tests/AbstractCliTest'
|
|
3
3
|
|
|
4
4
|
export default class GlobalEmitterTest extends AbstractCliTest {
|
|
@@ -7,4 +7,25 @@ export default class GlobalEmitterTest extends AbstractCliTest {
|
|
|
7
7
|
//@ts-ignore
|
|
8
8
|
assert.isTrue(this.emitter.shouldEmitSequentally)
|
|
9
9
|
}
|
|
10
|
+
|
|
11
|
+
@test()
|
|
12
|
+
protected static async didExecuteAcceptsInstalledPackages() {
|
|
13
|
+
await this.emitter.on('feature.did-execute', () => {
|
|
14
|
+
return {
|
|
15
|
+
packagesInstalled: [
|
|
16
|
+
{
|
|
17
|
+
isDev: true,
|
|
18
|
+
name: generateId(),
|
|
19
|
+
version: generateId(),
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
await this.emitter.emitAndFlattenResponses('feature.did-execute', {
|
|
26
|
+
actionCode: generateId(),
|
|
27
|
+
featureCode: 'permission',
|
|
28
|
+
results: {},
|
|
29
|
+
})
|
|
30
|
+
}
|
|
10
31
|
}
|
|
@@ -109,8 +109,7 @@ export default class SkillStoreTest extends AbstractCliTest {
|
|
|
109
109
|
|
|
110
110
|
errorAssert.assertError(err, 'GENERIC')
|
|
111
111
|
|
|
112
|
-
const
|
|
113
|
-
const namespace = pkg.get('skill.namespace')
|
|
112
|
+
const namespace = this.Service('pkg').getSkillNamespace()
|
|
114
113
|
assert.isEqual(namespace, slug)
|
|
115
114
|
}
|
|
116
115
|
|
|
@@ -69,8 +69,8 @@ export default abstract class AbstractAction<S extends Schema = Schema>
|
|
|
69
69
|
options: SchemaValues<S>
|
|
70
70
|
): Promise<FeatureActionResponse>
|
|
71
71
|
|
|
72
|
-
protected Action(featureCode:
|
|
73
|
-
return this.actionExecuter.Action(featureCode
|
|
72
|
+
protected Action(featureCode: FeatureCode, actionCode: string) {
|
|
73
|
+
return this.actionExecuter.Action(featureCode, actionCode)
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
public Service<S extends Service>(type: S, cwd?: string): ServiceMap[S] {
|