@sprucelabs/spruce-cli 14.28.7 → 14.28.8
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/stores/CreatingADataStore.test.js +4 -1
- package/build/__tests__/behavioral/stores/CreatingADataStore.test.js.map +1 -1
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.d.ts +1 -1
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js +40 -40
- package/build/__tests__/behavioral/stores/KeepingDataStoresInSync.test.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/behavioral/stores/CreatingADataStore.test.ts +1 -0
- package/src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts +4 -4
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
|
+
## [14.28.8](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.28.7...v14.28.8) (2021-12-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [14.28.7](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.28.6...v14.28.7) (2021-12-06)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -172,7 +172,10 @@ var CreatingDataStoresTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
172
172
|
|
|
173
173
|
_test.assert.isTrue(_spruceSkillUtils.diskUtil.doesFileExist(file));
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
_context4.next = 4;
|
|
176
|
+
return this.Service('typeChecker').check(file);
|
|
177
|
+
|
|
178
|
+
case 4:
|
|
176
179
|
case "end":
|
|
177
180
|
return _context4.stop();
|
|
178
181
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/CreatingADataStore.test.ts"],"names":["CreatingDataStoresTest","assert","isFunction","Action","execute","cli","checkHealth","shouldRunOnSourceFiles","health","isFalsy","skill","errors","isTruthy","store","isArray","stores","isLength","nameReadable","nameReadablePlural","namePascal","results","path","testUtil","assertFileByNameInGeneratedFiles","files","Service","check","file","resolveHashSprucePath","isTrue","diskUtil","doesFileExist","isEqual","name","errorAssertUtil","assertError","storeContents","readFile","replace","writeFile","testFile","resolveTestPath","testContents","dest","resolvePath","isFalse","getAbstractTestPath","CommandService","setMockResponse","code","storesFile","deleteFile","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,sB,WAGnB,iB,UAKA,iB,UAWA,iB,UAkBA,iB,UAMA,iB,UASA,iB,UAkBA,iB,UAWA,iB,UAYA,iB,WA+BA,iB,WAOA,iB;;;;;;;;;;;;;gHAhID;AAAA;AAAA;AAAA;AAAA;AAECC,6BAAOC,UAAP,CAAkB,KAAKC,MAAL,CAAY,OAAZ,EAAqB,QAArB,EAA+BC,OAAjD;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;2HAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEsB,KAAKC,GAAL,CAASC,WAAT,CAAqB;AAAEC,kBAAAA,sBAAsB,EAAE;AAA1B,iBAArB,CAFtB;;AAAA;AAEOC,gBAAAA,MAFP;;AAICP,6BAAOQ,OAAP,CAAeD,MAAM,CAACE,KAAP,CAAaC,MAA5B;;AACAV,6BAAOW,QAAP,CAAgBJ,MAAM,CAACK,KAAvB;;AACAZ,6BAAOQ,OAAP,CAAeD,MAAM,CAACK,KAAP,CAAaF,MAA5B;;AACAV,6B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P;AACA;;;EArJkDQ,8B,8DAClB,Q","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport '@sprucelabs/spruce-store-plugin'\nimport CommandService from '../../../services/CommandService'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class CreatingDataStoresTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'stores'\n\n\t@test()\n\tprotected static async hasCreateStoreAction() {\n\t\tassert.isFunction(this.Action('store', 'create').execute)\n\t}\n\n\t@test()\n\tprotected static async getsNoStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isFalsy(health.skill.errors)\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isArray(health.store.stores)\n\t\tassert.isLength(health.store.stores, 0)\n\t}\n\n\t@test()\n\tprotected static async generatesValidStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Person',\n\t\t\tnameReadablePlural: 'People',\n\t\t\tnamePascal: 'Person',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'People.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async generatesAMapFile() {\n\t\tconst file = this.resolveHashSprucePath('stores', 'stores.ts')\n\t\tassert.isTrue(diskUtil.doesFileExist(file))\n\t}\n\n\t@test()\n\tprotected static async getsOneStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 1)\n\t\tassert.isEqual(health.store.stores[0].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async canGenerateASecondStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Bids.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async getsSecondStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 2)\n\t\tassert.isEqual(health.store.stores[0].name, 'Bids')\n\t\tassert.isEqual(health.store.stores[1].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async errorsWhenGeneratingAStoreWithTheSameName() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isTruthy(results.errors)\n\t\terrorAssertUtil.assertError(results.errors[0], 'STORE_EXISTS')\n\t}\n\n\t@test()\n\tprotected static async storeFactoryAndStoresAreTyped() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Product',\n\t\t\tnameReadablePlural: 'Products',\n\t\t\tnamePascal: 'Product',\n\t\t})\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Products.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst storeContents = diskUtil\n\t\t\t.readFile(path)\n\t\t\t.replace(\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions',\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions & {hello: string}'\n\t\t\t)\n\n\t\tdiskUtil.writeFile(path, storeContents)\n\n\t\tconst testFile = this.resolveTestPath('store-test.ts.hbs')\n\t\tconst testContents = diskUtil.readFile(testFile)\n\n\t\tconst dest = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(dest, testContents)\n\n\t\tawait this.Service('typeChecker').check(dest)\n\t}\n\n\t@test()\n\tprotected static async doesNotCreateAbstractTestFileBecauseTestIsNotInstalled() {\n\t\tassert.isFalse(\n\t\t\tdiskUtil.doesFileExist(CreatingDataStoresTest.getAbstractTestPath())\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async upgradeRestoresDataStoreTypes() {\n\t\tCommandService.setMockResponse('yarn rebuild', {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tCommandService.setMockResponse(/yarn add/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst storesFile = this.resolveHashSprucePath('stores/stores.types.ts')\n\t\tdiskUtil.deleteFile(storesFile)\n\t\tawait this.Action('node', 'upgrade').execute({})\n\t\tassert.isTrue(diskUtil.doesFileExist(storesFile))\n\t}\n\n\tprivate static getAbstractTestPath(): string {\n\t\treturn this.resolvePath('src', 'tests', 'AbstractDataStoreTest.ts')\n\t}\n}\n"],"file":"CreatingADataStore.test.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/CreatingADataStore.test.ts"],"names":["CreatingDataStoresTest","assert","isFunction","Action","execute","cli","checkHealth","shouldRunOnSourceFiles","health","isFalsy","skill","errors","isTruthy","store","isArray","stores","isLength","nameReadable","nameReadablePlural","namePascal","results","path","testUtil","assertFileByNameInGeneratedFiles","files","Service","check","file","resolveHashSprucePath","isTrue","diskUtil","doesFileExist","isEqual","name","errorAssertUtil","assertError","storeContents","readFile","replace","writeFile","testFile","resolveTestPath","testContents","dest","resolvePath","isFalse","getAbstractTestPath","CommandService","setMockResponse","code","storesFile","deleteFile","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAC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,CACCf,2BAASC,aAAT,CAAuB/B,sBAAsB,CAAC8C,mBAAvB,EAAvB,CADD;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;yHAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAECC,2CAAeC,eAAf,CAA+B,cAA/B,EAA+C;AAC9CC,kBAAAA,IAAI,EAAE;AADwC,iBAA/C;;AAIAF,2CAAeC,eAAf,CAA+B,YAA/B,EAA8C;AAC7CC,kBAAAA,IAAI,EAAE;AADuC,iBAA9C;;AAIMC,gBAAAA,UAVP,GAUoB,KAAKtB,qBAAL,CAA2B,wBAA3B,CAVpB;;AAWCE,2CAASqB,UAAT,CAAoBD,UAApB;;AAXD;AAAA,uBAYO,KAAK/C,MAAL,CAAY,MAAZ,EAAoB,SAApB,EAA+BC,OAA/B,CAAuC,EAAvC,CAZP;;AAAA;AAaCH,6BAAO4B,MAAP,CAAcC,2BAASC,aAAT,CAAuBmB,UAAvB,CAAd;;AAbD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAgBA,+BAA6C;AAC5C,aAAO,KAAKN,WAAL,CAAiB,KAAjB,EAAwB,OAAxB,EAAiC,0BAAjC,CAAP;AACA;;;EAtJkDQ,8B,8DAClB,Q","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport '@sprucelabs/spruce-store-plugin'\nimport CommandService from '../../../services/CommandService'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class CreatingDataStoresTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'stores'\n\n\t@test()\n\tprotected static async hasCreateStoreAction() {\n\t\tassert.isFunction(this.Action('store', 'create').execute)\n\t}\n\n\t@test()\n\tprotected static async getsNoStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isFalsy(health.skill.errors)\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isArray(health.store.stores)\n\t\tassert.isLength(health.store.stores, 0)\n\t}\n\n\t@test()\n\tprotected static async generatesValidStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Person',\n\t\t\tnameReadablePlural: 'People',\n\t\t\tnamePascal: 'Person',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'People.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async generatesAMapFile() {\n\t\tconst file = this.resolveHashSprucePath('stores', 'stores.ts')\n\t\tassert.isTrue(diskUtil.doesFileExist(file))\n\t\tawait this.Service('typeChecker').check(file)\n\t}\n\n\t@test()\n\tprotected static async getsOneStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 1)\n\t\tassert.isEqual(health.store.stores[0].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async canGenerateASecondStoreFile() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Bids.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(path)\n\t}\n\n\t@test()\n\tprotected static async getsSecondStoresBackFromHealthCheck() {\n\t\tconst health = await this.cli.checkHealth({ shouldRunOnSourceFiles: true })\n\n\t\tassert.isTruthy(health.store)\n\t\tassert.isFalsy(health.store.errors)\n\t\tassert.isLength(health.store.stores, 2)\n\t\tassert.isEqual(health.store.stores[0].name, 'Bids')\n\t\tassert.isEqual(health.store.stores[1].name, 'People')\n\t}\n\n\t@test()\n\tprotected static async errorsWhenGeneratingAStoreWithTheSameName() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tassert.isTruthy(results.errors)\n\t\terrorAssertUtil.assertError(results.errors[0], 'STORE_EXISTS')\n\t}\n\n\t@test()\n\tprotected static async storeFactoryAndStoresAreTyped() {\n\t\tconst results = await this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Product',\n\t\t\tnameReadablePlural: 'Products',\n\t\t\tnamePascal: 'Product',\n\t\t})\n\n\t\tconst path = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'Products.store.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst storeContents = diskUtil\n\t\t\t.readFile(path)\n\t\t\t.replace(\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions',\n\t\t\t\t'type ProductsStoreOptions = UniversalStoreOptions & {hello: string}'\n\t\t\t)\n\n\t\tdiskUtil.writeFile(path, storeContents)\n\n\t\tconst testFile = this.resolveTestPath('store-test.ts.hbs')\n\t\tconst testContents = diskUtil.readFile(testFile)\n\n\t\tconst dest = this.resolvePath('src', 'test.ts')\n\t\tdiskUtil.writeFile(dest, testContents)\n\n\t\tawait this.Service('typeChecker').check(dest)\n\t}\n\n\t@test()\n\tprotected static async doesNotCreateAbstractTestFileBecauseTestIsNotInstalled() {\n\t\tassert.isFalse(\n\t\t\tdiskUtil.doesFileExist(CreatingDataStoresTest.getAbstractTestPath())\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async upgradeRestoresDataStoreTypes() {\n\t\tCommandService.setMockResponse('yarn rebuild', {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tCommandService.setMockResponse(/yarn add/gis, {\n\t\t\tcode: 0,\n\t\t})\n\n\t\tconst storesFile = this.resolveHashSprucePath('stores/stores.types.ts')\n\t\tdiskUtil.deleteFile(storesFile)\n\t\tawait this.Action('node', 'upgrade').execute({})\n\t\tassert.isTrue(diskUtil.doesFileExist(storesFile))\n\t}\n\n\tprivate static getAbstractTestPath(): string {\n\t\treturn this.resolvePath('src', 'tests', 'AbstractDataStoreTest.ts')\n\t}\n}\n"],"file":"CreatingADataStore.test.js"}
|
|
@@ -6,7 +6,7 @@ export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
|
|
|
6
6
|
protected static beforeEach(): Promise<void>;
|
|
7
7
|
protected static hasSyncAction(): Promise<void>;
|
|
8
8
|
protected static syncsNothingToStart(): Promise<void>;
|
|
9
|
-
private static syncStores;
|
|
10
9
|
protected static badFileReturnsError(): Promise<void>;
|
|
11
10
|
protected static generatesValidTypeFile(): Promise<void>;
|
|
11
|
+
private static syncStores;
|
|
12
12
|
}
|
|
@@ -164,46 +164,22 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
164
164
|
|
|
165
165
|
return syncsNothingToStart;
|
|
166
166
|
}()
|
|
167
|
-
}, {
|
|
168
|
-
key: "syncStores",
|
|
169
|
-
value: function () {
|
|
170
|
-
var _syncStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
171
|
-
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
172
|
-
while (1) {
|
|
173
|
-
switch (_context5.prev = _context5.next) {
|
|
174
|
-
case 0:
|
|
175
|
-
return _context5.abrupt("return", this.Action('store', 'sync').execute({}));
|
|
176
|
-
|
|
177
|
-
case 1:
|
|
178
|
-
case "end":
|
|
179
|
-
return _context5.stop();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}, _callee5, this);
|
|
183
|
-
}));
|
|
184
|
-
|
|
185
|
-
function syncStores() {
|
|
186
|
-
return _syncStores.apply(this, arguments);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
return syncStores;
|
|
190
|
-
}()
|
|
191
167
|
}, {
|
|
192
168
|
key: "badFileReturnsError",
|
|
193
169
|
value: function () {
|
|
194
|
-
var _badFileReturnsError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
170
|
+
var _badFileReturnsError = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
195
171
|
var results;
|
|
196
|
-
return _regenerator["default"].wrap(function
|
|
172
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
197
173
|
while (1) {
|
|
198
|
-
switch (
|
|
174
|
+
switch (_context5.prev = _context5.next) {
|
|
199
175
|
case 0:
|
|
200
176
|
_spruceSkillUtils.diskUtil.writeFile(this.badStoreDest, 'throw new Error("Cheese!")');
|
|
201
177
|
|
|
202
|
-
|
|
178
|
+
_context5.next = 3;
|
|
203
179
|
return this.syncStores();
|
|
204
180
|
|
|
205
181
|
case 3:
|
|
206
|
-
results =
|
|
182
|
+
results = _context5.sent;
|
|
207
183
|
|
|
208
184
|
_test.assert.isArray(results.errors);
|
|
209
185
|
|
|
@@ -215,10 +191,10 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
215
191
|
|
|
216
192
|
case 7:
|
|
217
193
|
case "end":
|
|
218
|
-
return
|
|
194
|
+
return _context5.stop();
|
|
219
195
|
}
|
|
220
196
|
}
|
|
221
|
-
},
|
|
197
|
+
}, _callee5, this);
|
|
222
198
|
}));
|
|
223
199
|
|
|
224
200
|
function badFileReturnsError() {
|
|
@@ -230,13 +206,13 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
230
206
|
}, {
|
|
231
207
|
key: "generatesValidTypeFile",
|
|
232
208
|
value: function () {
|
|
233
|
-
var _generatesValidTypeFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
209
|
+
var _generatesValidTypeFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
234
210
|
var results, typesFile;
|
|
235
|
-
return _regenerator["default"].wrap(function
|
|
211
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
236
212
|
while (1) {
|
|
237
|
-
switch (
|
|
213
|
+
switch (_context6.prev = _context6.next) {
|
|
238
214
|
case 0:
|
|
239
|
-
|
|
215
|
+
_context6.next = 2;
|
|
240
216
|
return this.Action('store', 'create').execute({
|
|
241
217
|
nameReadable: 'Bid',
|
|
242
218
|
nameReadablePlural: 'Bids',
|
|
@@ -244,21 +220,21 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
244
220
|
});
|
|
245
221
|
|
|
246
222
|
case 2:
|
|
247
|
-
|
|
223
|
+
_context6.next = 4;
|
|
248
224
|
return this.syncStores();
|
|
249
225
|
|
|
250
226
|
case 4:
|
|
251
|
-
results =
|
|
227
|
+
results = _context6.sent;
|
|
252
228
|
typesFile = _test2["default"].assertFileByNameInGeneratedFiles('stores.types.ts', results.files);
|
|
253
|
-
|
|
229
|
+
_context6.next = 8;
|
|
254
230
|
return this.Service('typeChecker').check(typesFile);
|
|
255
231
|
|
|
256
232
|
case 8:
|
|
257
233
|
case "end":
|
|
258
|
-
return
|
|
234
|
+
return _context6.stop();
|
|
259
235
|
}
|
|
260
236
|
}
|
|
261
|
-
},
|
|
237
|
+
}, _callee6, this);
|
|
262
238
|
}));
|
|
263
239
|
|
|
264
240
|
function generatesValidTypeFile() {
|
|
@@ -267,6 +243,30 @@ var KeepingDataStoresInSyncTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
|
|
|
267
243
|
|
|
268
244
|
return generatesValidTypeFile;
|
|
269
245
|
}()
|
|
246
|
+
}, {
|
|
247
|
+
key: "syncStores",
|
|
248
|
+
value: function () {
|
|
249
|
+
var _syncStores = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
250
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
251
|
+
while (1) {
|
|
252
|
+
switch (_context7.prev = _context7.next) {
|
|
253
|
+
case 0:
|
|
254
|
+
return _context7.abrupt("return", this.Action('store', 'sync').execute({}));
|
|
255
|
+
|
|
256
|
+
case 1:
|
|
257
|
+
case "end":
|
|
258
|
+
return _context7.stop();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}, _callee7, this);
|
|
262
|
+
}));
|
|
263
|
+
|
|
264
|
+
function syncStores() {
|
|
265
|
+
return _syncStores.apply(this, arguments);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return syncStores;
|
|
269
|
+
}()
|
|
270
270
|
}]);
|
|
271
271
|
return KeepingDataStoresInSyncTest;
|
|
272
272
|
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'stores'), (0, _defineProperty2["default"])(_class2, "badStoreDest", void 0), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasSyncAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasSyncAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "syncsNothingToStart", [_dec2], Object.getOwnPropertyDescriptor(_class, "syncsNothingToStart"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "badFileReturnsError", [_dec3], Object.getOwnPropertyDescriptor(_class, "badFileReturnsError"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidTypeFile", [_dec4], Object.getOwnPropertyDescriptor(_class, "generatesValidTypeFile"), _class)), _class));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts"],"names":["KeepingDataStoresInSyncTest","badStoreDest","resolvePath","diskUtil","deleteFile","assert","isFunction","Action","execute","syncStores","results","isLength","files","writeFile","isArray","errors","errorAssertUtil","assertError","file","nameReadable","nameReadablePlural","namePascal","typesFile","testUtil","assertFileByNameInGeneratedFiles","Service","check","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,2B,WAanB,iB,UAKA,iB,
|
|
1
|
+
{"version":3,"sources":["../../../../src/__tests__/behavioral/stores/KeepingDataStoresInSync.test.ts"],"names":["KeepingDataStoresInSyncTest","badStoreDest","resolvePath","diskUtil","deleteFile","assert","isFunction","Action","execute","syncStores","results","isLength","files","writeFile","isArray","errors","errorAssertUtil","assertError","file","nameReadable","nameReadablePlural","namePascal","typesFile","testUtil","assertFileByNameInGeneratedFiles","Service","check","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,2B,WAanB,iB,UAKA,iB,UAOA,iB,UAaA,iB;;;;;;;;;;;;;qGAnCD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAEC,qBAAKC,YAAL,GAAoB,KAAKC,WAAL,CAAiB,yBAAjB,CAApB;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;sGAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;AAAA;AAECC,2CAASC,UAAT,CAAoB,KAAKH,YAAzB;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;yGAKA;AAAA;AAAA;AAAA;AAAA;AAECI,6BAAOC,UAAP,CAAkB,KAAKC,MAAL,CAAY,OAAZ,EAAqB,MAArB,EAA6BC,OAA/C;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;+GAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEuB,KAAKC,UAAL,EAFvB;;AAAA;AAEOC,gBAAAA,OAFP;;AAICL,6B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,OAA7B,CAAqC,EAArC,CADR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAxDwDmB,8B,8DACvB,Q","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport AbstractSkillTest from '../../../tests/AbstractSkillTest'\nimport testUtil from '../../../tests/utilities/test.utility'\n\nexport default class KeepingDataStoresInSyncTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'stores'\n\tprotected static badStoreDest: string\n\tprotected static async beforeAll() {\n\t\tawait super.beforeAll()\n\t\tthis.badStoreDest = this.resolvePath('src/stores/Bad.store.ts')\n\t}\n\n\tprotected static async beforeEach() {\n\t\tawait super.beforeEach()\n\t\tdiskUtil.deleteFile(this.badStoreDest)\n\t}\n\n\t@test()\n\tprotected static async hasSyncAction() {\n\t\tassert.isFunction(this.Action('store', 'sync').execute)\n\t}\n\n\t@test()\n\tprotected static async syncsNothingToStart() {\n\t\tconst results = await this.syncStores()\n\n\t\tassert.isLength(results.files, 0)\n\t}\n\n\t@test()\n\tprotected static async badFileReturnsError() {\n\t\tdiskUtil.writeFile(this.badStoreDest, 'throw new Error(\"Cheese!\")')\n\n\t\tconst results = await this.syncStores()\n\t\tassert.isArray(results.errors)\n\t\tassert.isLength(results.errors, 1)\n\n\t\terrorAssertUtil.assertError(results.errors[0], 'FAILED_TO_IMPORT', {\n\t\t\tfile: 'Bad.store.ts',\n\t\t})\n\t}\n\n\t@test()\n\tprotected static async generatesValidTypeFile() {\n\t\tawait this.Action('store', 'create').execute({\n\t\t\tnameReadable: 'Bid',\n\t\t\tnameReadablePlural: 'Bids',\n\t\t\tnamePascal: 'Bid',\n\t\t})\n\n\t\tconst results = await this.syncStores()\n\n\t\tconst typesFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'stores.types.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(typesFile)\n\t}\n\n\tprivate static async syncStores() {\n\t\treturn this.Action('store', 'sync').execute({})\n\t}\n}\n"],"file":"KeepingDataStoresInSync.test.js"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"version": "14.28.
|
|
21
|
+
"version": "14.28.8",
|
|
22
22
|
"bin": {
|
|
23
23
|
"spruce": "./build/index.js"
|
|
24
24
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@sprucelabs/spruce-event-utils": "^17.1.272",
|
|
89
89
|
"@sprucelabs/spruce-skill-booter": "^17.0.4",
|
|
90
90
|
"@sprucelabs/spruce-skill-utils": "^22.1.50",
|
|
91
|
-
"@sprucelabs/spruce-templates": "^14.28.
|
|
91
|
+
"@sprucelabs/spruce-templates": "^14.28.8",
|
|
92
92
|
"cfonts": "^2.10.0",
|
|
93
93
|
"chalk": "^4.1.2",
|
|
94
94
|
"chokidar": "^3.5.2",
|
|
@@ -595,5 +595,5 @@
|
|
|
595
595
|
"ora"
|
|
596
596
|
]
|
|
597
597
|
},
|
|
598
|
-
"gitHead": "
|
|
598
|
+
"gitHead": "c6881eaf61ca60574a87b6cb8c15738f85ec4f96"
|
|
599
599
|
}
|
|
@@ -47,6 +47,7 @@ export default class CreatingDataStoresTest extends AbstractSkillTest {
|
|
|
47
47
|
protected static async generatesAMapFile() {
|
|
48
48
|
const file = this.resolveHashSprucePath('stores', 'stores.ts')
|
|
49
49
|
assert.isTrue(diskUtil.doesFileExist(file))
|
|
50
|
+
await this.Service('typeChecker').check(file)
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
@test()
|
|
@@ -29,10 +29,6 @@ export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
|
|
|
29
29
|
assert.isLength(results.files, 0)
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
private static async syncStores() {
|
|
33
|
-
return this.Action('store', 'sync').execute({})
|
|
34
|
-
}
|
|
35
|
-
|
|
36
32
|
@test()
|
|
37
33
|
protected static async badFileReturnsError() {
|
|
38
34
|
diskUtil.writeFile(this.badStoreDest, 'throw new Error("Cheese!")')
|
|
@@ -63,4 +59,8 @@ export default class KeepingDataStoresInSyncTest extends AbstractSkillTest {
|
|
|
63
59
|
|
|
64
60
|
await this.Service('typeChecker').check(typesFile)
|
|
65
61
|
}
|
|
62
|
+
|
|
63
|
+
private static async syncStores() {
|
|
64
|
+
return this.Action('store', 'sync').execute({})
|
|
65
|
+
}
|
|
66
66
|
}
|