@sprucelabs/spruce-cli 15.2.0 → 15.2.1

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 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
+ ## [15.2.1](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v15.2.0...v15.2.1) (2022-02-14)
7
+
8
+ **Note:** Version bump only for package @sprucelabs/spruce-cli
9
+
10
+
11
+
12
+
13
+
6
14
  # [15.2.0](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v15.1.8...v15.2.0) (2022-02-13)
7
15
 
8
16
 
@@ -7,8 +7,8 @@ export default class CreatingBehavioralTestsTest extends AbstractTestTest {
7
7
  protected static listsManyDirsIfExistInsideTestDir(): Promise<void>;
8
8
  protected static selectingAnOptionRendersToSubDir(dirName: string): Promise<void>;
9
9
  protected static doesNotListFiles(): Promise<void>;
10
- private static installStartTestSelectSubclassWaitForInput;
11
10
  private static createTestSubDir;
12
11
  private static resolveTestDir;
13
12
  private static installAndStartTestActionAndWaitForInput;
13
+ private static waitAndSelectSubClass;
14
14
  }
@@ -41,7 +41,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
41
41
 
42
42
  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; } }
43
43
 
44
- var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)('can create behavioral test with AbstractSpruceFixtureTest', 'AbstractSpruceFixtureTest'), _dec4 = (0, _test.test)('can create behavioral test with AbstractSpruceFixtureTest', 'AbstractStoreTest (requires install)'), _dec5 = (0, _test.test)('finds folders inside behavioral', 'behavioral'), _dec6 = (0, _test.test)('finds folders inside implementation', 'implementation'), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)('can select subdir 1', 'test'), _dec9 = (0, _test.test)('can select subdir 2', 'test-2'), _dec10 = (0, _test.test)(), (_class = /*#__PURE__*/function (_AbstractTestTest) {
44
+ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(), _dec3 = (0, _test.test)('can create behavioral test with AbstractSpruceFixtureTest', 'AbstractSpruceFixtureTest'), _dec4 = (0, _test.test)('can create behavioral test with AbstractStoreTest', 'AbstractStoreTest (requires install)'), _dec5 = (0, _test.test)('finds folders inside behavioral', 'behavioral'), _dec6 = (0, _test.test)('finds folders inside implementation', 'implementation'), _dec7 = (0, _test.test)(), _dec8 = (0, _test.test)('can select subdir 1', 'test'), _dec9 = (0, _test.test)('can select subdir 2', 'test-2'), _dec10 = (0, _test.test)(), (_class = /*#__PURE__*/function (_AbstractTestTest) {
45
45
  (0, _inherits2["default"])(CreatingBehavioralTestsTest, _AbstractTestTest);
46
46
 
47
47
  var _super = _createSuper(CreatingBehavioralTestsTest);
@@ -171,7 +171,7 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
171
171
  key: "promptsToSelectFolderIfInsideTestDir",
172
172
  value: function () {
173
173
  var _promptsToSelectFolderIfInsideTestDir = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(testType) {
174
- var _yield$this$installSt, promise;
174
+ var _yield$this$installAn2, promise;
175
175
 
176
176
  return _regenerator["default"].wrap(function _callee4$(_context4) {
177
177
  while (1) {
@@ -183,11 +183,11 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
183
183
  case 2:
184
184
  this.createTestSubDir(testType, 'dummy1');
185
185
  _context4.next = 5;
186
- return this.installStartTestSelectSubclassWaitForInput(testType);
186
+ return this.installAndStartTestActionAndWaitForInput(testType);
187
187
 
188
188
  case 5:
189
- _yield$this$installSt = _context4.sent;
190
- promise = _yield$this$installSt.promise;
189
+ _yield$this$installAn2 = _context4.sent;
190
+ promise = _yield$this$installAn2.promise;
191
191
 
192
192
  _uiAssert["default"].assertSelectRenderChoice(this.ui, '.', testType);
193
193
 
@@ -198,9 +198,13 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
198
198
 
199
199
  case 11:
200
200
  _context4.next = 13;
201
- return promise;
201
+ return this.waitAndSelectSubClass();
202
202
 
203
203
  case 13:
204
+ _context4.next = 15;
205
+ return promise;
206
+
207
+ case 15:
204
208
  case "end":
205
209
  return _context4.stop();
206
210
  }
@@ -218,7 +222,7 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
218
222
  key: "listsManyDirsIfExistInsideTestDir",
219
223
  value: function () {
220
224
  var _listsManyDirsIfExistInsideTestDir = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
221
- var dirs, _i, _dirs, dir, _yield$this$installSt2, promise, _i2, _dirs2, _dir;
225
+ var dirs, _i, _dirs, dir, _yield$this$installAn3, promise, _i2, _dirs2, _dir;
222
226
 
223
227
  return _regenerator["default"].wrap(function _callee5$(_context5) {
224
228
  while (1) {
@@ -236,11 +240,11 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
236
240
  }
237
241
 
238
242
  _context5.next = 6;
239
- return this.installStartTestSelectSubclassWaitForInput();
243
+ return this.installAndStartTestActionAndWaitForInput();
240
244
 
241
245
  case 6:
242
- _yield$this$installSt2 = _context5.sent;
243
- promise = _yield$this$installSt2.promise;
246
+ _yield$this$installAn3 = _context5.sent;
247
+ promise = _yield$this$installAn3.promise;
244
248
 
245
249
  for (_i2 = 0, _dirs2 = dirs; _i2 < _dirs2.length; _i2++) {
246
250
  _dir = _dirs2[_i2];
@@ -253,9 +257,13 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
253
257
 
254
258
  case 11:
255
259
  _context5.next = 13;
256
- return promise;
260
+ return this.waitAndSelectSubClass();
257
261
 
258
262
  case 13:
263
+ _context5.next = 15;
264
+ return promise;
265
+
266
+ case 15:
259
267
  case "end":
260
268
  return _context5.stop();
261
269
  }
@@ -275,7 +283,7 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
275
283
  var _selectingAnOptionRendersToSubDir = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(dirName) {
276
284
  var _results$files, _results$files$;
277
285
 
278
- var _yield$this$installSt3, promise, results, expectedPath;
286
+ var _yield$this$installAn4, promise, results, expectedPath;
279
287
 
280
288
  return _regenerator["default"].wrap(function _callee6$(_context6) {
281
289
  while (1) {
@@ -287,25 +295,29 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
287
295
  case 2:
288
296
  this.createTestSubDir('behavioral', dirName);
289
297
  _context6.next = 5;
290
- return this.installStartTestSelectSubclassWaitForInput('behavioral');
298
+ return this.installAndStartTestActionAndWaitForInput('behavioral');
291
299
 
292
300
  case 5:
293
- _yield$this$installSt3 = _context6.sent;
294
- promise = _yield$this$installSt3.promise;
301
+ _yield$this$installAn4 = _context6.sent;
302
+ promise = _yield$this$installAn4.promise;
295
303
  _context6.next = 9;
296
304
  return this.ui.sendInput("".concat(dirName));
297
305
 
298
306
  case 9:
299
307
  _context6.next = 11;
300
- return promise;
308
+ return this.waitAndSelectSubClass();
301
309
 
302
310
  case 11:
311
+ _context6.next = 13;
312
+ return promise;
313
+
314
+ case 13:
303
315
  results = _context6.sent;
304
316
  expectedPath = this.resolvePath('src', '__tests__', 'behavioral', dirName, 'CanBookAppointment.test.ts');
305
317
 
306
318
  _test.assert.isEqual(expectedPath, (_results$files = results.files) === null || _results$files === void 0 ? void 0 : (_results$files$ = _results$files[0]) === null || _results$files$ === void 0 ? void 0 : _results$files$.path);
307
319
 
308
- case 14:
320
+ case 16:
309
321
  case "end":
310
322
  return _context6.stop();
311
323
  }
@@ -323,8 +335,7 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
323
335
  key: "doesNotListFiles",
324
336
  value: function () {
325
337
  var _doesNotListFiles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
326
- var file, _yield$this$installSt4, promise;
327
-
338
+ var file;
328
339
  return _regenerator["default"].wrap(function _callee7$(_context7) {
329
340
  while (1) {
330
341
  switch (_context7.prev = _context7.next) {
@@ -339,18 +350,14 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
339
350
  _spruceSkillUtils.diskUtil.writeFile(file, 'what the!?');
340
351
 
341
352
  _context7.next = 7;
342
- return this.installStartTestSelectSubclassWaitForInput();
353
+ return this.installAndStartTestActionAndWaitForInput();
343
354
 
344
355
  case 7:
345
- _yield$this$installSt4 = _context7.sent;
346
- promise = _yield$this$installSt4.promise;
347
-
348
356
  _uiAssert["default"].assertSelectDidNotRenderChoice(this.ui, 'test', "behavioral/test/test.ts");
349
357
 
350
- _context7.next = 12;
351
- return promise;
358
+ this.ui.reset();
352
359
 
353
- case 12:
360
+ case 9:
354
361
  case "end":
355
362
  return _context7.stop();
356
363
  }
@@ -364,48 +371,6 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
364
371
 
365
372
  return doesNotListFiles;
366
373
  }()
367
- }, {
368
- key: "installStartTestSelectSubclassWaitForInput",
369
- value: function () {
370
- var _installStartTestSelectSubclassWaitForInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(testType, selectedSubClass) {
371
- var _yield$this$installAn2, promise;
372
-
373
- return _regenerator["default"].wrap(function _callee8$(_context8) {
374
- while (1) {
375
- switch (_context8.prev = _context8.next) {
376
- case 0:
377
- _context8.next = 2;
378
- return this.installAndStartTestActionAndWaitForInput(testType);
379
-
380
- case 2:
381
- _yield$this$installAn2 = _context8.sent;
382
- promise = _yield$this$installAn2.promise;
383
- _context8.next = 6;
384
- return this.ui.sendInput(selectedSubClass !== null && selectedSubClass !== void 0 ? selectedSubClass : '');
385
-
386
- case 6:
387
- _context8.next = 8;
388
- return _uiAssert["default"].assertRendersSelect(this.ui);
389
-
390
- case 8:
391
- return _context8.abrupt("return", {
392
- promise: promise
393
- });
394
-
395
- case 9:
396
- case "end":
397
- return _context8.stop();
398
- }
399
- }
400
- }, _callee8, this);
401
- }));
402
-
403
- function installStartTestSelectSubclassWaitForInput(_x4, _x5) {
404
- return _installStartTestSelectSubclassWaitForInput.apply(this, arguments);
405
- }
406
-
407
- return installStartTestSelectSubclassWaitForInput;
408
- }()
409
374
  }, {
410
375
  key: "createTestSubDir",
411
376
  value: function createTestSubDir() {
@@ -425,16 +390,16 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
425
390
  }, {
426
391
  key: "installAndStartTestActionAndWaitForInput",
427
392
  value: function () {
428
- var _installAndStartTestActionAndWaitForInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
393
+ var _installAndStartTestActionAndWaitForInput = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
429
394
  var testType,
430
395
  promise,
431
- _args9 = arguments;
432
- return _regenerator["default"].wrap(function _callee9$(_context9) {
396
+ _args8 = arguments;
397
+ return _regenerator["default"].wrap(function _callee8$(_context8) {
433
398
  while (1) {
434
- switch (_context9.prev = _context9.next) {
399
+ switch (_context8.prev = _context8.next) {
435
400
  case 0:
436
- testType = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : 'behavioral';
437
- _context9.next = 3;
401
+ testType = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : 'behavioral';
402
+ _context8.next = 3;
438
403
  return this.installTests();
439
404
 
440
405
  case 3:
@@ -444,20 +409,20 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
444
409
  nameCamel: 'canBookAppointment',
445
410
  namePascal: 'CanBookAppointment'
446
411
  });
447
- _context9.next = 6;
412
+ _context8.next = 6;
448
413
  return this.waitForInput();
449
414
 
450
415
  case 6:
451
- return _context9.abrupt("return", {
416
+ return _context8.abrupt("return", {
452
417
  promise: promise
453
418
  });
454
419
 
455
420
  case 7:
456
421
  case "end":
457
- return _context9.stop();
422
+ return _context8.stop();
458
423
  }
459
424
  }
460
- }, _callee9, this);
425
+ }, _callee8, this);
461
426
  }));
462
427
 
463
428
  function installAndStartTestActionAndWaitForInput() {
@@ -466,6 +431,35 @@ var CreatingBehavioralTestsTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.t
466
431
 
467
432
  return installAndStartTestActionAndWaitForInput;
468
433
  }()
434
+ }, {
435
+ key: "waitAndSelectSubClass",
436
+ value: function () {
437
+ var _waitAndSelectSubClass = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(selectedSubClass) {
438
+ return _regenerator["default"].wrap(function _callee9$(_context9) {
439
+ while (1) {
440
+ switch (_context9.prev = _context9.next) {
441
+ case 0:
442
+ _context9.next = 2;
443
+ return this.waitForInput();
444
+
445
+ case 2:
446
+ _context9.next = 4;
447
+ return this.ui.sendInput(selectedSubClass !== null && selectedSubClass !== void 0 ? selectedSubClass : '');
448
+
449
+ case 4:
450
+ case "end":
451
+ return _context9.stop();
452
+ }
453
+ }
454
+ }, _callee9, this);
455
+ }));
456
+
457
+ function waitAndSelectSubClass(_x4) {
458
+ return _waitAndSelectSubClass.apply(this, arguments);
459
+ }
460
+
461
+ return waitAndSelectSubClass;
462
+ }()
469
463
  }]);
470
464
  return CreatingBehavioralTestsTest;
471
465
  }(_AbstractTestTest2["default"]), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "requiresInstallIfFeatureNotInstalled", [_dec2], Object.getOwnPropertyDescriptor(_class, "requiresInstallIfFeatureNotInstalled"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canCreateBehavioralTest", [_dec3, _dec4], Object.getOwnPropertyDescriptor(_class, "canCreateBehavioralTest"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "promptsToSelectFolderIfInsideTestDir", [_dec5, _dec6], Object.getOwnPropertyDescriptor(_class, "promptsToSelectFolderIfInsideTestDir"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "listsManyDirsIfExistInsideTestDir", [_dec7], Object.getOwnPropertyDescriptor(_class, "listsManyDirsIfExistInsideTestDir"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "selectingAnOptionRendersToSubDir", [_dec8, _dec9], Object.getOwnPropertyDescriptor(_class, "selectingAnOptionRendersToSubDir"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "doesNotListFiles", [_dec10], Object.getOwnPropertyDescriptor(_class, "doesNotListFiles"), _class)), _class));
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/__tests__/behavioral/tests/CreatingATest.test.ts"],"names":["CreatingBehavioralTestsTest","assert","isFunction","Action","execute","installTests","testFeature","getFeatureInstaller","getFeature","buildParentClassCandidates","candidates","doesInclude","label","name","testName","LintService","enableLinting","installAndStartTestActionAndWaitForInput","promise","selectOptionBasedOnLabel","response","match","testUtil","assertFileByNameInGeneratedFiles","files","Service","build","doesThrowAsync","testType","createTestSubDir","installStartTestSelectSubclassWaitForInput","uiAssert","assertSelectRenderChoice","ui","sendInput","dirs","dir","dirName","results","expectedPath","resolvePath","isEqual","path","file","resolveTestDir","diskUtil","writeFile","assertSelectDidNotRenderChoice","selectedSubClass","assertRendersSelect","newDir","createDir","testDirs","type","nameReadable","nameCamel","namePascal","waitForInput","AbstractTestTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;A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A,OAJP,GAIiB,KAAKf,MAAL,CAAY,MAAZ,EAAoB,QAApB,EAA8BC,OAA9B,CAAsC;AACrDiD,kBAAAA,IAAI,EAAEzB,QAD+C;AAErD0B,kBAAAA,YAAY,EAAE,sBAFuC;AAGrDC,kBAAAA,SAAS,EAAE,oBAH0C;AAIrDC,kBAAAA,UAAU,EAAE;AAJyC,iBAAtC,CAJjB;AAAA;AAAA,uBAWO,KAAKC,YAAL,EAXP;;AAAA;AAAA,kDAYQ;AAAEvC,kBAAAA,OAAO,EAAPA;AAAF,iBAZR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EAhKwDwC,6B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport LintService from '../../../services/LintService'\nimport AbstractTestTest from '../../../tests/AbstractTestTest'\nimport testUtil from '../../../tests/utilities/test.utility'\nimport uiAssert from '../../../tests/utilities/uiAssert.utility'\n\nexport default class CreatingBehavioralTestsTest extends AbstractTestTest {\n\t@test()\n\tprotected static async hasCreateAction() {\n\t\tassert.isFunction(this.Action('test', 'create').execute)\n\t}\n\n\t@test()\n\tprotected static async requiresInstallIfFeatureNotInstalled() {\n\t\tawait this.installTests('testsInNodeModule')\n\n\t\tconst testFeature = this.getFeatureInstaller().getFeature('test')\n\t\tconst candidates = await testFeature.buildParentClassCandidates()\n\n\t\tassert.doesInclude(candidates, {\n\t\t\tlabel: 'AbstractSpruceFixtureTest (requires install)',\n\t\t\tname: 'AbstractSpruceFixtureTest',\n\t\t})\n\t}\n\n\t@test(\n\t\t'can create behavioral test with AbstractSpruceFixtureTest',\n\t\t'AbstractSpruceFixtureTest'\n\t)\n\t@test(\n\t\t'can create behavioral test with AbstractSpruceFixtureTest',\n\t\t'AbstractStoreTest (requires install)'\n\t)\n\tprotected static async canCreateBehavioralTest(testName: string) {\n\t\tLintService.enableLinting()\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput()\n\n\t\tthis.selectOptionBasedOnLabel(testName)\n\n\t\tconst response = await promise\n\n\t\tconst match = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'CanBookAppointment.test.ts',\n\t\t\tresponse.files\n\t\t)\n\n\t\tassert.doesInclude(match, 'behavioral')\n\n\t\tawait this.Service('build').build()\n\n\t\tawait assert.doesThrowAsync(\n\t\t\t() => this.Service('command').execute('yarn test'),\n\t\t\t/false.*?does not equal.*?true/gis\n\t\t)\n\t}\n\n\t@test('finds folders inside behavioral', 'behavioral')\n\t@test('finds folders inside implementation', 'implementation')\n\tprotected static async promptsToSelectFolderIfInsideTestDir(\n\t\ttestType: string\n\t) {\n\t\tawait this.installTests()\n\n\t\tthis.createTestSubDir(testType, 'dummy1')\n\n\t\tconst { promise } = await this.installStartTestSelectSubclassWaitForInput(\n\t\t\ttestType\n\t\t)\n\n\t\tuiAssert.assertSelectRenderChoice(this.ui, '.', testType)\n\t\tuiAssert.assertSelectRenderChoice(this.ui, `dummy1`, `${testType}/dummy1`)\n\n\t\tawait this.ui.sendInput('.')\n\n\t\tawait promise\n\t}\n\n\t@test()\n\tprotected static async listsManyDirsIfExistInsideTestDir() {\n\t\tawait this.installTests()\n\n\t\tconst dirs = ['dir1', 'dir2', 'dir3']\n\n\t\tfor (const dir of dirs) {\n\t\t\tthis.createTestSubDir('behavioral', dir)\n\t\t}\n\n\t\tconst { promise } = await this.installStartTestSelectSubclassWaitForInput()\n\n\t\tfor (const dir of dirs) {\n\t\t\tuiAssert.assertSelectRenderChoice(this.ui, `${dir}`, `behavioral/${dir}`)\n\t\t}\n\n\t\tawait this.ui.sendInput('.')\n\n\t\tawait promise\n\t}\n\n\t@test('can select subdir 1', 'test')\n\t@test('can select subdir 2', 'test-2')\n\tprotected static async selectingAnOptionRendersToSubDir(dirName: string) {\n\t\tawait this.installTests()\n\t\tthis.createTestSubDir('behavioral', dirName)\n\n\t\tconst { promise } = await this.installStartTestSelectSubclassWaitForInput(\n\t\t\t'behavioral'\n\t\t)\n\n\t\tawait this.ui.sendInput(`${dirName}`)\n\n\t\tconst results = await promise\n\n\t\tconst expectedPath = this.resolvePath(\n\t\t\t'src',\n\t\t\t'__tests__',\n\t\t\t'behavioral',\n\t\t\tdirName,\n\t\t\t'CanBookAppointment.test.ts'\n\t\t)\n\n\t\tassert.isEqual(expectedPath, results.files?.[0]?.path)\n\t}\n\n\t@test()\n\tprotected static async doesNotListFiles() {\n\t\tawait this.installTests()\n\t\tthis.createTestSubDir('behavioral', 'subdir')\n\n\t\tconst file = this.resolveTestDir('behavioral', 'test.ts')\n\t\tdiskUtil.writeFile(file, 'what the!?')\n\n\t\tconst { promise } = await this.installStartTestSelectSubclassWaitForInput()\n\n\t\tuiAssert.assertSelectDidNotRenderChoice(\n\t\t\tthis.ui,\n\t\t\t'test',\n\t\t\t`behavioral/test/test.ts`\n\t\t)\n\n\t\tawait promise\n\t}\n\n\tprivate static async installStartTestSelectSubclassWaitForInput(\n\t\ttestType?: string,\n\t\tselectedSubClass?: string\n\t) {\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput(\n\t\t\ttestType\n\t\t)\n\n\t\tawait this.ui.sendInput(selectedSubClass ?? '')\n\n\t\tawait uiAssert.assertRendersSelect(this.ui)\n\n\t\treturn { promise }\n\t}\n\n\tprivate static createTestSubDir(...testDirs: string[]) {\n\t\tconst newDir = this.resolveTestDir(...testDirs)\n\t\tdiskUtil.createDir(newDir)\n\t}\n\n\tprivate static resolveTestDir(...testDirs: string[]) {\n\t\treturn this.resolvePath('src', '__tests__', ...testDirs)\n\t}\n\n\tprivate static async installAndStartTestActionAndWaitForInput(\n\t\ttestType = 'behavioral'\n\t) {\n\t\tawait this.installTests()\n\t\tconst promise = this.Action('test', 'create').execute({\n\t\t\ttype: testType,\n\t\t\tnameReadable: 'Can book appointment',\n\t\t\tnameCamel: 'canBookAppointment',\n\t\t\tnamePascal: 'CanBookAppointment',\n\t\t})\n\n\t\tawait this.waitForInput()\n\t\treturn { promise }\n\t}\n}\n"],"file":"CreatingATest.test.js"}
1
+ {"version":3,"sources":["../../../../src/__tests__/behavioral/tests/CreatingATest.test.ts"],"names":["CreatingBehavioralTestsTest","assert","isFunction","Action","execute","installTests","testFeature","getFeatureInstaller","getFeature","buildParentClassCandidates","candidates","doesInclude","label","name","testName","LintService","enableLinting","installAndStartTestActionAndWaitForInput","promise","selectOptionBasedOnLabel","response","match","testUtil","assertFileByNameInGeneratedFiles","files","Service","build","doesThrowAsync","testType","createTestSubDir","uiAssert","assertSelectRenderChoice","ui","sendInput","waitAndSelectSubClass","dirs","dir","dirName","results","expectedPath","resolvePath","isEqual","path","file","resolveTestDir","diskUtil","writeFile","assertSelectDidNotRenderChoice","reset","newDir","createDir","testDirs","type","nameReadable","nameCamel","namePascal","waitForInput","selectedSubClass","AbstractTestTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;IAEqBA,2B,WACnB,iB,UAKA,iB,UAaA,gBACA,2DADA,EAEA,2BAFA,C,UAIA,gBACA,mDADA,EAEA,sCAFA,C,UA2BA,gBAAK,iCAAL,EAAwC,YAAxC,C,UACA,gBAAK,qCAAL,EAA4C,gBAA5C,C,UAqBA,iB,UAuBA,gBAAK,qBAAL,EAA4B,MAA5B,C,UACA,gBAAK,qBAAL,EAA4B,QAA5B,C,WA0BA,iB;;;;;;;;;;;;;2GAzHD;AAAA;AAAA;AAAA;AAAA;AAECC,6BAAOC,UAAP,CAAkB,KAAKC,MAAL,CAAY,MAAZ,EAAoB,QAApB,EAA8BC,OAAhD;;AAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;gIAKA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAEO,KAAKC,YAAL,CAAkB,mBAAlB,CAFP;;AAAA;AAIOC,gBAAAA,WAJP,GAIqB,KAAKC,mBAAL,GAA2BC,UAA3B,CAAsC,MAAtC,CAJrB;AAAA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B,EAAwB,WAAxB,SAAwCW,QAAxC,EAAP;AACA;;;;oIAED;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACCvB,gBAAAA,QADD,8DACY,YADZ;AAAA;AAAA,uBAGO,KAAKvB,YAAL,EAHP;;AAAA;AAIOa,gBAAAA,OAJP,GAIiB,KAAKf,MAAL,CAAY,MAAZ,EAAoB,QAApB,EAA8BC,OAA9B,CAAsC;AACrDgD,kBAAAA,IAAI,EAAExB,QAD+C;AAErDyB,kBAAAA,YAAY,EAAE,sBAFuC;AAGrDC,kBAAAA,SAAS,EAAE,oBAH0C;AAIrDC,kBAAAA,UAAU,EAAE;AAJyC,iBAAtC,CAJjB;AAAA;AAAA,uBAWO,KAAKC,YAAL,EAXP;;AAAA;AAAA,kDAYQ;AAAEtC,kBAAAA,OAAO,EAAPA;AAAF,iBAZR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;iHAeA,kBAA2CuC,gBAA3C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBACO,KAAKD,YAAL,EADP;;AAAA;AAAA;AAAA,uBAEO,KAAKxB,EAAL,CAAQC,SAAR,CAAkBwB,gBAAlB,aAAkBA,gBAAlB,cAAkBA,gBAAlB,GAAsC,EAAtC,CAFP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EArKwDC,6B","sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport LintService from '../../../services/LintService'\nimport AbstractTestTest from '../../../tests/AbstractTestTest'\nimport testUtil from '../../../tests/utilities/test.utility'\nimport uiAssert from '../../../tests/utilities/uiAssert.utility'\n\nexport default class CreatingBehavioralTestsTest extends AbstractTestTest {\n\t@test()\n\tprotected static async hasCreateAction() {\n\t\tassert.isFunction(this.Action('test', 'create').execute)\n\t}\n\n\t@test()\n\tprotected static async requiresInstallIfFeatureNotInstalled() {\n\t\tawait this.installTests('testsInNodeModule')\n\n\t\tconst testFeature = this.getFeatureInstaller().getFeature('test')\n\t\tconst candidates = await testFeature.buildParentClassCandidates()\n\n\t\tassert.doesInclude(candidates, {\n\t\t\tlabel: 'AbstractSpruceFixtureTest (requires install)',\n\t\t\tname: 'AbstractSpruceFixtureTest',\n\t\t})\n\t}\n\n\t@test(\n\t\t'can create behavioral test with AbstractSpruceFixtureTest',\n\t\t'AbstractSpruceFixtureTest'\n\t)\n\t@test(\n\t\t'can create behavioral test with AbstractStoreTest',\n\t\t'AbstractStoreTest (requires install)'\n\t)\n\tprotected static async canCreateBehavioralTest(testName: string) {\n\t\tLintService.enableLinting()\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput()\n\n\t\tthis.selectOptionBasedOnLabel(testName)\n\n\t\tconst response = await promise\n\n\t\tconst match = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'CanBookAppointment.test.ts',\n\t\t\tresponse.files\n\t\t)\n\n\t\tassert.doesInclude(match, 'behavioral')\n\n\t\tawait this.Service('build').build()\n\n\t\tawait assert.doesThrowAsync(\n\t\t\t() => this.Service('command').execute('yarn test'),\n\t\t\t/false.*?does not equal.*?true/gis\n\t\t)\n\t}\n\n\t@test('finds folders inside behavioral', 'behavioral')\n\t@test('finds folders inside implementation', 'implementation')\n\tprotected static async promptsToSelectFolderIfInsideTestDir(\n\t\ttestType: string\n\t) {\n\t\tawait this.installTests()\n\n\t\tthis.createTestSubDir(testType, 'dummy1')\n\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput(\n\t\t\ttestType\n\t\t)\n\n\t\tuiAssert.assertSelectRenderChoice(this.ui, '.', testType)\n\t\tuiAssert.assertSelectRenderChoice(this.ui, `dummy1`, `${testType}/dummy1`)\n\n\t\tawait this.ui.sendInput('.')\n\t\tawait this.waitAndSelectSubClass()\n\n\t\tawait promise\n\t}\n\n\t@test()\n\tprotected static async listsManyDirsIfExistInsideTestDir() {\n\t\tawait this.installTests()\n\n\t\tconst dirs = ['dir1', 'dir2', 'dir3']\n\n\t\tfor (const dir of dirs) {\n\t\t\tthis.createTestSubDir('behavioral', dir)\n\t\t}\n\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput()\n\n\t\tfor (const dir of dirs) {\n\t\t\tuiAssert.assertSelectRenderChoice(this.ui, `${dir}`, `behavioral/${dir}`)\n\t\t}\n\n\t\tawait this.ui.sendInput('.')\n\n\t\tawait this.waitAndSelectSubClass()\n\n\t\tawait promise\n\t}\n\n\t@test('can select subdir 1', 'test')\n\t@test('can select subdir 2', 'test-2')\n\tprotected static async selectingAnOptionRendersToSubDir(dirName: string) {\n\t\tawait this.installTests()\n\t\tthis.createTestSubDir('behavioral', dirName)\n\n\t\tconst { promise } = await this.installAndStartTestActionAndWaitForInput(\n\t\t\t'behavioral'\n\t\t)\n\n\t\tawait this.ui.sendInput(`${dirName}`)\n\n\t\tawait this.waitAndSelectSubClass()\n\n\t\tconst results = await promise\n\n\t\tconst expectedPath = this.resolvePath(\n\t\t\t'src',\n\t\t\t'__tests__',\n\t\t\t'behavioral',\n\t\t\tdirName,\n\t\t\t'CanBookAppointment.test.ts'\n\t\t)\n\n\t\tassert.isEqual(expectedPath, results.files?.[0]?.path)\n\t}\n\n\t@test()\n\tprotected static async doesNotListFiles() {\n\t\tawait this.installTests()\n\t\tthis.createTestSubDir('behavioral', 'subdir')\n\n\t\tconst file = this.resolveTestDir('behavioral', 'test.ts')\n\t\tdiskUtil.writeFile(file, 'what the!?')\n\n\t\tawait this.installAndStartTestActionAndWaitForInput()\n\n\t\tuiAssert.assertSelectDidNotRenderChoice(\n\t\t\tthis.ui,\n\t\t\t'test',\n\t\t\t`behavioral/test/test.ts`\n\t\t)\n\n\t\tthis.ui.reset()\n\t}\n\n\tprivate static createTestSubDir(...testDirs: string[]) {\n\t\tconst newDir = this.resolveTestDir(...testDirs)\n\t\tdiskUtil.createDir(newDir)\n\t}\n\n\tprivate static resolveTestDir(...testDirs: string[]) {\n\t\treturn this.resolvePath('src', '__tests__', ...testDirs)\n\t}\n\n\tprivate static async installAndStartTestActionAndWaitForInput(\n\t\ttestType = 'behavioral'\n\t) {\n\t\tawait this.installTests()\n\t\tconst promise = this.Action('test', 'create').execute({\n\t\t\ttype: testType,\n\t\t\tnameReadable: 'Can book appointment',\n\t\t\tnameCamel: 'canBookAppointment',\n\t\t\tnamePascal: 'CanBookAppointment',\n\t\t})\n\n\t\tawait this.waitForInput()\n\t\treturn { promise }\n\t}\n\n\tprivate static async waitAndSelectSubClass(selectedSubClass?: string) {\n\t\tawait this.waitForInput()\n\t\tawait this.ui.sendInput(selectedSubClass ?? '')\n\t}\n}\n"],"file":"CreatingATest.test.js"}
@@ -1,9 +1,14 @@
1
1
  import AbstractTestTest from '../../../tests/AbstractTestTest';
2
2
  export default class SelectingAnAbstractTestClassTest extends AbstractTestTest {
3
3
  protected static asksForYouToSelectABaseClass(): Promise<void>;
4
+ protected static canSelectAbstractClassWhileSelectingSubDir(): Promise<void>;
4
5
  protected static canSelectAbstractTestBasedOnEventEmitter(): Promise<void>;
5
6
  protected static installingAFeatureRemovesLabelFromName(): Promise<void>;
6
7
  protected static selectingUninistalledTestInstallsTheFeature(): Promise<void>;
8
+ private static buildAndAssertTestFailsAsExpected;
9
+ private static installCopyTestFilesSelectLocalAbstractTest;
10
+ private static installAndCopyTestFiles;
7
11
  private static copyTestFiles;
8
12
  private static executeCreateUntilAbstractClassSelection;
13
+ private static invokeCreateActionAndWaitForInput;
9
14
  }