@sprucelabs/spruce-cli 14.24.9 → 14.25.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 +11 -0
- package/build/__tests__/behavioral/views/CreatingASkillView.test.d.ts +1 -0
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +33 -3
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +12 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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
|
+
# [14.25.0](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.24.9...v14.25.0) (2021-11-05)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* Gave developers the ability to get code assistance when building custom views in heartwood ([c38fd2d](https://github.com/sprucelabsai/spruce-cli-workspace/commit/c38fd2d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [14.24.9](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.24.8...v14.24.9) (2021-11-05)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -17,5 +17,6 @@ export default class CreatingASkillViewTest extends AbstractSkillTest {
|
|
|
17
17
|
protected static skillViewExtendsAbstractViewControllerWithProperView(): void;
|
|
18
18
|
protected static nicelyTypesRootSkillViewController(): Promise<void>;
|
|
19
19
|
protected static nicelyTypesViewController(): Promise<void>;
|
|
20
|
+
protected static typesViewControllerOptions(): Promise<void>;
|
|
20
21
|
private static buildTestfile;
|
|
21
22
|
}
|
|
@@ -37,13 +37,13 @@ var _AbstractSkillTest2 = _interopRequireDefault(require("../../../tests/Abstrac
|
|
|
37
37
|
|
|
38
38
|
var _test2 = _interopRequireDefault(require("../../../tests/utilities/test.utility"));
|
|
39
39
|
|
|
40
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _class, _class2, _temp;
|
|
40
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _class, _class2, _temp;
|
|
41
41
|
|
|
42
42
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
43
43
|
|
|
44
44
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
45
45
|
|
|
46
|
-
var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)(), _dec6 = (0, _test.test)(), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)(), _dec9 = (0, _test.test)(), _dec10 = (0, _test.test)(), _dec11 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
46
|
+
var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)(), _dec6 = (0, _test.test)(), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)(), _dec9 = (0, _test.test)(), _dec10 = (0, _test.test)(), _dec11 = (0, _test.test)(), _dec12 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
47
47
|
(0, _inherits2["default"])(CreatingASkillViewTest, _AbstractSkillTest);
|
|
48
48
|
|
|
49
49
|
var _super = _createSuper(CreatingASkillViewTest);
|
|
@@ -450,6 +450,36 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
450
450
|
|
|
451
451
|
return nicelyTypesViewController;
|
|
452
452
|
}()
|
|
453
|
+
}, {
|
|
454
|
+
key: "typesViewControllerOptions",
|
|
455
|
+
value: function () {
|
|
456
|
+
var _typesViewControllerOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
457
|
+
var viewsFile, viewContents;
|
|
458
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
459
|
+
while (1) {
|
|
460
|
+
switch (_context11.prev = _context11.next) {
|
|
461
|
+
case 0:
|
|
462
|
+
viewsFile = this.resolveHashSprucePath('views', 'views.ts');
|
|
463
|
+
viewContents = _spruceSkillUtils.diskUtil.readFile(viewsFile);
|
|
464
|
+
|
|
465
|
+
_test.assert.doesInclude(viewContents, "interface ViewControllerOptionsMap");
|
|
466
|
+
|
|
467
|
+
_test.assert.doesInclude(viewContents, "'testing-views.appointments-card': ConstructorParameters<typeof AppointmentsCardViewController>[0]");
|
|
468
|
+
|
|
469
|
+
case 4:
|
|
470
|
+
case "end":
|
|
471
|
+
return _context11.stop();
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}, _callee11, this);
|
|
475
|
+
}));
|
|
476
|
+
|
|
477
|
+
function typesViewControllerOptions() {
|
|
478
|
+
return _typesViewControllerOptions.apply(this, arguments);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return typesViewControllerOptions;
|
|
482
|
+
}()
|
|
453
483
|
}, {
|
|
454
484
|
key: "buildTestfile",
|
|
455
485
|
value: function buildTestfile(options) {
|
|
@@ -459,6 +489,6 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
459
489
|
}
|
|
460
490
|
}]);
|
|
461
491
|
return CreatingASkillViewTest;
|
|
462
|
-
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'views'), (0, _defineProperty2["default"])(_class2, "action", void 0), (0, _defineProperty2["default"])(_class2, "rootSvc", void 0), (0, _defineProperty2["default"])(_class2, "appointmentsCard", void 0), (0, _defineProperty2["default"])(_class2, "dashboardVc", void 0), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksIfRootSkillViewIfNotYetCreated", [_dec2], Object.getOwnPropertyDescriptor(_class, "asksIfRootSkillViewIfNotYetCreated"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canCreateRootSkillView", [_dec3], Object.getOwnPropertyDescriptor(_class, "canCreateRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidRootSkillView", [_dec4], Object.getOwnPropertyDescriptor(_class, "generatesValidRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "rootSkillViewExtendsAbstractSkillViewController", [_dec5], Object.getOwnPropertyDescriptor(_class, "rootSkillViewExtendsAbstractSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "cantCreateTwoRootSvcs", [_dec6], Object.getOwnPropertyDescriptor(_class, "cantCreateTwoRootSvcs"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForNamesIfCreatingSkillViewNotRoot", [_dec7], Object.getOwnPropertyDescriptor(_class, "asksForNamesIfCreatingSkillViewNotRoot"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForViewModelWhenCreatingSkillView", [_dec8], Object.getOwnPropertyDescriptor(_class, "asksForViewModelWhenCreatingSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "skillViewExtendsAbstractViewControllerWithProperView", [_dec9], Object.getOwnPropertyDescriptor(_class, "skillViewExtendsAbstractViewControllerWithProperView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesRootSkillViewController", [_dec10], Object.getOwnPropertyDescriptor(_class, "nicelyTypesRootSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesViewController", [_dec11], Object.getOwnPropertyDescriptor(_class, "nicelyTypesViewController"), _class)), _class));
|
|
492
|
+
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'views'), (0, _defineProperty2["default"])(_class2, "action", void 0), (0, _defineProperty2["default"])(_class2, "rootSvc", void 0), (0, _defineProperty2["default"])(_class2, "appointmentsCard", void 0), (0, _defineProperty2["default"])(_class2, "dashboardVc", void 0), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksIfRootSkillViewIfNotYetCreated", [_dec2], Object.getOwnPropertyDescriptor(_class, "asksIfRootSkillViewIfNotYetCreated"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canCreateRootSkillView", [_dec3], Object.getOwnPropertyDescriptor(_class, "canCreateRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidRootSkillView", [_dec4], Object.getOwnPropertyDescriptor(_class, "generatesValidRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "rootSkillViewExtendsAbstractSkillViewController", [_dec5], Object.getOwnPropertyDescriptor(_class, "rootSkillViewExtendsAbstractSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "cantCreateTwoRootSvcs", [_dec6], Object.getOwnPropertyDescriptor(_class, "cantCreateTwoRootSvcs"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForNamesIfCreatingSkillViewNotRoot", [_dec7], Object.getOwnPropertyDescriptor(_class, "asksForNamesIfCreatingSkillViewNotRoot"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForViewModelWhenCreatingSkillView", [_dec8], Object.getOwnPropertyDescriptor(_class, "asksForViewModelWhenCreatingSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "skillViewExtendsAbstractViewControllerWithProperView", [_dec9], Object.getOwnPropertyDescriptor(_class, "skillViewExtendsAbstractViewControllerWithProperView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesRootSkillViewController", [_dec10], Object.getOwnPropertyDescriptor(_class, "nicelyTypesRootSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesViewController", [_dec11], Object.getOwnPropertyDescriptor(_class, "nicelyTypesViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "typesViewControllerOptions", [_dec12], Object.getOwnPropertyDescriptor(_class, "typesViewControllerOptions"), _class)), _class));
|
|
463
493
|
exports["default"] = CreatingASkillViewTest;
|
|
464
494
|
//# sourceMappingURL=CreatingASkillView.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/__tests__/behavioral/views/CreatingASkillView.test.ts"],"names":["CreatingASkillViewTest","action","Action","assert","isFunction","execute","viewType","waitForInput","last","ui","lastInvocation","isEqual","command","reset","isRoot","results","isFalsy","errors","rootSvc","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","Service","check","contents","diskUtil","readFile","isTruthy","errorAssertUtil","assertError","name","promise","sendInput","dashboardVc","nameReadable","options","choices","value","appointmentsCard","buildTestfile","idInterfaceName","code","testFile","resolvePath","writeFile","importAll","imported","svcModel","svcId","vcModel","vcId","trim","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;IAEqBA,sB,WAYnB,iB,UAKA,iB,UAeA,iB,UAiBA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,OAAzB;;AACA/C,6BAAOyB,QAAP,CAAgBmB,QAAQ,CAACI,IAAzB;;AAhBD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAmBA,uBAA6Bf,OAA7B,EAGG;AACF,UAAQM,IAAR,GAAkCN,OAAlC,CAAQM,IAAR;AAAA,UAAcD,eAAd,GAAkCL,OAAlC,CAAcK,eAAd;AAEA,aACC,cAEA,6GAKAA,eALA,mYAiBDC,IAjBC,YAkBCU,IAlBD,EAHD;AAuBA;;;EAlNkDC,8B,8DAClB,O","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport CreateAction from '../../../features/view/actions/CreateAction'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class CreatingASkillViewTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprivate static action: CreateAction\n\tprivate static rootSvc: string\n\tpublic static appointmentsCard: string\n\tprivate static dashboardVc: string\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.action = this.Action('view', 'create') as CreateAction\n\t}\n\n\t@test()\n\tprotected static hasCreateAction() {\n\t\tassert.isFunction(this.action.execute)\n\t}\n\n\t@test()\n\tprotected static async asksIfRootSkillViewIfNotYetCreated() {\n\t\tvoid this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tconst last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'confirm')\n\n\t\tthis.ui.reset()\n\t}\n\n\t@test()\n\tprotected static async canCreateRootSkillView() {\n\t\tconst results = await this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t\tisRoot: true,\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.rootSvc = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Root.svc.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(this.rootSvc, 'skillViewControllers')\n\t}\n\n\t@test()\n\tprotected static async generatesValidRootSkillView() {\n\t\tawait this.Service('typeChecker').check(this.rootSvc)\n\t}\n\n\t@test()\n\tprotected static async rootSkillViewExtendsAbstractSkillViewController() {\n\t\tconst contents = diskUtil.readFile(this.rootSvc)\n\t\tassert.doesInclude(\n\t\t\tcontents,\n\t\t\t'export default class RootSkillViewController extends AbstractSkillViewController'\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async cantCreateTwoRootSvcs() {\n\t\tconst results = await this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t\tisRoot: true,\n\t\t})\n\n\t\tassert.isTruthy(results.errors)\n\n\t\terrorAssertUtil.assertError(results.errors?.[0], 'SKILL_VIEW_EXISTS', {\n\t\t\tname: 'Root',\n\t\t})\n\t}\n\n\t@test()\n\tprotected static async asksForNamesIfCreatingSkillViewNotRoot() {\n\t\tconst promise = this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tlet last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'prompt')\n\n\t\tawait this.ui.sendInput('Dashboard')\n\t\tawait this.ui.sendInput('\\n')\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.dashboardVc = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Dashboard.svc.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(this.dashboardVc, 'skillViewControllers')\n\n\t\tthis.ui.reset()\n\t}\n\n\t@test()\n\tprotected static async asksForViewModelWhenCreatingSkillView() {\n\t\tconst promise = this.action.execute({\n\t\t\tviewType: 'view',\n\t\t\tnameReadable: 'Appointments card',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tconst last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'prompt')\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tvalue: 'Card',\n\t\t})\n\n\t\tawait this.ui.sendInput('Card')\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.appointmentsCard = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'AppointmentsCard.vc.ts',\n\t\t\tresults.files\n\t\t)\n\t}\n\n\t@test()\n\tprotected static skillViewExtendsAbstractViewControllerWithProperView() {\n\t\tconst contents = diskUtil.readFile(this.appointmentsCard)\n\t\tassert.doesInclude(\n\t\t\tcontents,\n\t\t\t'export default class AppointmentsCardViewController extends AbstractViewController<Card>'\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async nicelyTypesRootSkillViewController() {\n\t\tconst contents = this.buildTestfile({\n\t\t\tidInterfaceName: 'SkillViewControllerId',\n\t\t\tcode: `\nconst root = vcFactory.Controller('testing-views.root', {})\nexport const svcModel = root.render()\nexport const svcId: SkillViewControllerId = 'testing-views.root'`,\n\t\t})\n\n\t\tconst testFile = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(testFile, contents)\n\n\t\tconst imported = await this.Service('import').importAll(testFile)\n\n\t\tassert.isTruthy(imported.svcModel)\n\t\tassert.isTruthy(imported.svcId)\n\t}\n\n\t@test()\n\tprotected static async nicelyTypesViewController() {\n\t\tconst contents = this.buildTestfile({\n\t\t\tidInterfaceName: 'ViewControllerId',\n\t\t\tcode: `\n\t\tconst apptCard = vcFactory.Controller('testing-views.appointments-card', {})\n\t\texport const vcModel = apptCard.render()\n\t\texport const vcId: ViewControllerId = 'testing-views.appointments-card'`,\n\t\t})\n\n\t\tconst testFile = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(testFile, contents)\n\n\t\tconst imported = await this.Service('import').importAll(testFile)\n\n\t\tassert.isTruthy(imported.vcModel)\n\t\tassert.isTruthy(imported.vcId)\n\t}\n\n\tprivate static buildTestfile(options: {\n\t\tcode: string\n\t\tidInterfaceName: 'SkillViewControllerId' | 'ViewControllerId'\n\t}) {\n\t\tconst { code, idInterfaceName } = options\n\n\t\treturn (\n\t\t\t`\nimport ` +\n\t\t\t`'#spruce/views/views'\nimport {\n\tViewControllerFactory,\n\tAuthenticatorImpl,\n\tMockStorage,\n\t${idInterfaceName},\n} from '@sprucelabs/heartwood-view-controllers'\nimport { vcDiskUtil } from '@sprucelabs/spruce-test-fixtures'\n\nAuthenticatorImpl.setStorage(new MockStorage())\n\nconst vcFactory = ViewControllerFactory.Factory({\n\tcontrollerMap: vcDiskUtil.loadViewControllersAndBuildMap('testing-views', __dirname),\n\tconnectToApi: async () => {\n\t\treturn 'yes' as any\n\t},\n})\n${code}\n\t\t`.trim()\n\t\t)\n\t}\n}\n"],"file":"CreatingASkillView.test.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/__tests__/behavioral/views/CreatingASkillView.test.ts"],"names":["CreatingASkillViewTest","action","Action","assert","isFunction","execute","viewType","waitForInput","last","ui","lastInvocation","isEqual","command","reset","isRoot","results","isFalsy","errors","rootSvc","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","Service","check","contents","diskUtil","readFile","isTruthy","errorAssertUtil","assertError","name","promise","sendInput","dashboardVc","nameReadable","options","choices","value","appointmentsCard","buildTestfile","idInterfaceName","code","testFile","resolvePath","writeFile","importAll","imported","svcModel","svcId","vcModel","vcId","viewsFile","resolveHashSprucePath","viewContents","trim","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;IAEqBA,sB,WAYnB,iB,UAKA,iB,UAeA,iB,UAiBA,iB,UAKA,iB,UASA,iB,UAcA,iB,UA6BA,iB,UA4BA,iB,WASA,iB,WAmBA,iB,WAmBA,iB;;;;;;;;;;;;;sGA9KD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAEC,qBAAKC,MAAL,GAAc,KAAKC,MAAL,CAAY,MAAZ,EAAoB,QAApB,CAAd;;AAFD;AAAA;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UAApC,CAFnB;AAGOC,gBAAAA,YAHP,GAGsB5B,2BAASC,QAAT,CAAkByB,SAAlB,CAHtB;;AAKCjD,6BAAOmB,WAAP,CAAmBgC,YAAnB;;AACAnD,6BAAOmB,WAAP,CACCgC,YADD;;AAND;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAYA,uBAA6BlB,OAA7B,EAGG;AACF,UAAQM,IAAR,GAAkCN,OAAlC,CAAQM,IAAR;AAAA,UAAcD,eAAd,GAAkCL,OAAlC,CAAcK,eAAd;AAEA,aACC,cAEA,6GAKAA,eALA,mYAiBDC,IAjBC,YAkBCa,IAlBD,EAHD;AAuBA;;;EA9NkDC,8B,8DAClB,O","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport CreateAction from '../../../features/view/actions/CreateAction'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class CreatingASkillViewTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'views'\n\tprivate static action: CreateAction\n\tprivate static rootSvc: string\n\tpublic static appointmentsCard: string\n\tprivate static dashboardVc: string\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tthis.action = this.Action('view', 'create') as CreateAction\n\t}\n\n\t@test()\n\tprotected static hasCreateAction() {\n\t\tassert.isFunction(this.action.execute)\n\t}\n\n\t@test()\n\tprotected static async asksIfRootSkillViewIfNotYetCreated() {\n\t\tvoid this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tconst last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'confirm')\n\n\t\tthis.ui.reset()\n\t}\n\n\t@test()\n\tprotected static async canCreateRootSkillView() {\n\t\tconst results = await this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t\tisRoot: true,\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.rootSvc = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Root.svc.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(this.rootSvc, 'skillViewControllers')\n\t}\n\n\t@test()\n\tprotected static async generatesValidRootSkillView() {\n\t\tawait this.Service('typeChecker').check(this.rootSvc)\n\t}\n\n\t@test()\n\tprotected static async rootSkillViewExtendsAbstractSkillViewController() {\n\t\tconst contents = diskUtil.readFile(this.rootSvc)\n\t\tassert.doesInclude(\n\t\t\tcontents,\n\t\t\t'export default class RootSkillViewController extends AbstractSkillViewController'\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async cantCreateTwoRootSvcs() {\n\t\tconst results = await this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t\tisRoot: true,\n\t\t})\n\n\t\tassert.isTruthy(results.errors)\n\n\t\terrorAssertUtil.assertError(results.errors?.[0], 'SKILL_VIEW_EXISTS', {\n\t\t\tname: 'Root',\n\t\t})\n\t}\n\n\t@test()\n\tprotected static async asksForNamesIfCreatingSkillViewNotRoot() {\n\t\tconst promise = this.action.execute({\n\t\t\tviewType: 'skillView',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tlet last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'prompt')\n\n\t\tawait this.ui.sendInput('Dashboard')\n\t\tawait this.ui.sendInput('\\n')\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.dashboardVc = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Dashboard.svc.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tassert.doesInclude(this.dashboardVc, 'skillViewControllers')\n\n\t\tthis.ui.reset()\n\t}\n\n\t@test()\n\tprotected static async asksForViewModelWhenCreatingSkillView() {\n\t\tconst promise = this.action.execute({\n\t\t\tviewType: 'view',\n\t\t\tnameReadable: 'Appointments card',\n\t\t})\n\n\t\tawait this.waitForInput()\n\n\t\tconst last = this.ui.lastInvocation()\n\n\t\tassert.isEqual(last.command, 'prompt')\n\t\tassert.doesInclude(last.options.options.choices, {\n\t\t\tvalue: 'Card',\n\t\t})\n\n\t\tawait this.ui.sendInput('Card')\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tthis.appointmentsCard = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'AppointmentsCard.vc.ts',\n\t\t\tresults.files\n\t\t)\n\t}\n\n\t@test()\n\tprotected static skillViewExtendsAbstractViewControllerWithProperView() {\n\t\tconst contents = diskUtil.readFile(this.appointmentsCard)\n\t\tassert.doesInclude(\n\t\t\tcontents,\n\t\t\t'export default class AppointmentsCardViewController extends AbstractViewController<Card>'\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async nicelyTypesRootSkillViewController() {\n\t\tconst contents = this.buildTestfile({\n\t\t\tidInterfaceName: 'SkillViewControllerId',\n\t\t\tcode: `\nconst root = vcFactory.Controller('testing-views.root', {})\nexport const svcModel = root.render()\nexport const svcId: SkillViewControllerId = 'testing-views.root'`,\n\t\t})\n\n\t\tconst testFile = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(testFile, contents)\n\n\t\tconst imported = await this.Service('import').importAll(testFile)\n\n\t\tassert.isTruthy(imported.svcModel)\n\t\tassert.isTruthy(imported.svcId)\n\t}\n\n\t@test()\n\tprotected static async nicelyTypesViewController() {\n\t\tconst contents = this.buildTestfile({\n\t\t\tidInterfaceName: 'ViewControllerId',\n\t\t\tcode: `\n\t\tconst apptCard = vcFactory.Controller('testing-views.appointments-card', {})\n\t\texport const vcModel = apptCard.render()\n\t\texport const vcId: ViewControllerId = 'testing-views.appointments-card'`,\n\t\t})\n\n\t\tconst testFile = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(testFile, contents)\n\n\t\tconst imported = await this.Service('import').importAll(testFile)\n\n\t\tassert.isTruthy(imported.vcModel)\n\t\tassert.isTruthy(imported.vcId)\n\t}\n\n\t@test()\n\tprotected static async typesViewControllerOptions() {\n\t\tconst viewsFile = this.resolveHashSprucePath('views', 'views.ts')\n\t\tconst viewContents = diskUtil.readFile(viewsFile)\n\n\t\tassert.doesInclude(viewContents, `interface ViewControllerOptionsMap`)\n\t\tassert.doesInclude(\n\t\t\tviewContents,\n\t\t\t`'testing-views.appointments-card': ConstructorParameters<typeof AppointmentsCardViewController>[0]`\n\t\t)\n\t}\n\n\tprivate static buildTestfile(options: {\n\t\tcode: string\n\t\tidInterfaceName: 'SkillViewControllerId' | 'ViewControllerId'\n\t}) {\n\t\tconst { code, idInterfaceName } = options\n\n\t\treturn (\n\t\t\t`\nimport ` +\n\t\t\t`'#spruce/views/views'\nimport {\n\tViewControllerFactory,\n\tAuthenticatorImpl,\n\tMockStorage,\n\t${idInterfaceName},\n} from '@sprucelabs/heartwood-view-controllers'\nimport { vcDiskUtil } from '@sprucelabs/spruce-test-fixtures'\n\nAuthenticatorImpl.setStorage(new MockStorage())\n\nconst vcFactory = ViewControllerFactory.Factory({\n\tcontrollerMap: vcDiskUtil.loadViewControllersAndBuildMap('testing-views', __dirname),\n\tconnectToApi: async () => {\n\t\treturn 'yes' as any\n\t},\n})\n${code}\n\t\t`.trim()\n\t\t)\n\t}\n}\n"],"file":"CreatingASkillView.test.js"}
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
19
|
"license": "MIT",
|
|
20
|
-
"version": "14.
|
|
20
|
+
"version": "14.25.0",
|
|
21
21
|
"bin": {
|
|
22
22
|
"spruce": "./build/index.js"
|
|
23
23
|
},
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"@sprucelabs/spruce-event-utils": "^16.0.712",
|
|
88
88
|
"@sprucelabs/spruce-skill-booter": "^7.1.4",
|
|
89
89
|
"@sprucelabs/spruce-skill-utils": "^22.0.10",
|
|
90
|
-
"@sprucelabs/spruce-templates": "^14.
|
|
90
|
+
"@sprucelabs/spruce-templates": "^14.25.0",
|
|
91
91
|
"cfonts": "^2.10.0",
|
|
92
92
|
"chalk": "^4.1.2",
|
|
93
93
|
"chokidar": "^3.5.2",
|
|
@@ -593,5 +593,5 @@
|
|
|
593
593
|
"ora"
|
|
594
594
|
]
|
|
595
595
|
},
|
|
596
|
-
"gitHead": "
|
|
596
|
+
"gitHead": "425ef4beba3f1d08fe1e8c99d9c38d309bade97b"
|
|
597
597
|
}
|
|
@@ -186,6 +186,18 @@ export const svcId: SkillViewControllerId = 'testing-views.root'`,
|
|
|
186
186
|
assert.isTruthy(imported.vcId)
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
@test()
|
|
190
|
+
protected static async typesViewControllerOptions() {
|
|
191
|
+
const viewsFile = this.resolveHashSprucePath('views', 'views.ts')
|
|
192
|
+
const viewContents = diskUtil.readFile(viewsFile)
|
|
193
|
+
|
|
194
|
+
assert.doesInclude(viewContents, `interface ViewControllerOptionsMap`)
|
|
195
|
+
assert.doesInclude(
|
|
196
|
+
viewContents,
|
|
197
|
+
`'testing-views.appointments-card': ConstructorParameters<typeof AppointmentsCardViewController>[0]`
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
|
|
189
201
|
private static buildTestfile(options: {
|
|
190
202
|
code: string
|
|
191
203
|
idInterfaceName: 'SkillViewControllerId' | 'ViewControllerId'
|