@sprucelabs/spruce-cli 15.4.8 → 15.4.9
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/views/CreatingASkillView.test.d.ts +1 -0
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js +118 -77
- package/build/__tests__/behavioral/views/CreatingASkillView.test.js.map +1 -1
- package/build/features/view/ViewFeature.js +1 -1
- package/build/features/view/ViewFeature.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/behavioral/views/CreatingASkillView.test.ts +20 -0
- package/src/features/view/ViewFeature.ts +1 -1
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.4.9](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v15.4.8...v15.4.9) (2022-05-10)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [15.4.8](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v15.4.7...v15.4.8) (2022-05-10)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -7,6 +7,7 @@ export default class CreatingASkillViewTest extends AbstractSkillTest {
|
|
|
7
7
|
private static dashboardVc;
|
|
8
8
|
protected static beforeEach(): Promise<void>;
|
|
9
9
|
protected static hasCreateAction(): void;
|
|
10
|
+
protected static viewFieatureHasExpectedDependencies(): Promise<void>;
|
|
10
11
|
protected static asksIfRootSkillViewIfNotYetCreated(): Promise<void>;
|
|
11
12
|
protected static canCreateRootSkillView(): Promise<void>;
|
|
12
13
|
protected static generatesValidRootSkillView(): Promise<void>;
|
|
@@ -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, _dec12, _dec13, _class, _class2;
|
|
40
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _class, _class2;
|
|
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)(), _dec12 = (0, _test.test)(), _dec13 = (0, _test.test)(), (_class = (_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)(), _dec13 = (0, _test.test)(), _dec14 = (0, _test.test)(), (_class = (_class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
47
47
|
(0, _inherits2["default"])(CreatingASkillViewTest, _AbstractSkillTest);
|
|
48
48
|
|
|
49
49
|
var _super = _createSuper(CreatingASkillViewTest);
|
|
@@ -87,18 +87,59 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
87
87
|
_test.assert.isFunction(this.action.execute);
|
|
88
88
|
}
|
|
89
89
|
}, {
|
|
90
|
-
key: "
|
|
90
|
+
key: "viewFieatureHasExpectedDependencies",
|
|
91
91
|
value: function () {
|
|
92
|
-
var
|
|
93
|
-
var
|
|
92
|
+
var _viewFieatureHasExpectedDependencies = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
|
|
93
|
+
var features, view;
|
|
94
94
|
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
95
95
|
while (1) {
|
|
96
96
|
switch (_context2.prev = _context2.next) {
|
|
97
|
+
case 0:
|
|
98
|
+
_context2.next = 2;
|
|
99
|
+
return this.getFeatureInstaller();
|
|
100
|
+
|
|
101
|
+
case 2:
|
|
102
|
+
features = _context2.sent;
|
|
103
|
+
view = features.getFeature('view');
|
|
104
|
+
|
|
105
|
+
_test.assert.isEqualDeep(view.dependencies, [{
|
|
106
|
+
code: 'node',
|
|
107
|
+
isRequired: true
|
|
108
|
+
}, {
|
|
109
|
+
code: 'schema',
|
|
110
|
+
isRequired: true
|
|
111
|
+
}, {
|
|
112
|
+
code: 'event',
|
|
113
|
+
isRequired: true
|
|
114
|
+
}]);
|
|
115
|
+
|
|
116
|
+
case 5:
|
|
117
|
+
case "end":
|
|
118
|
+
return _context2.stop();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}, _callee2, this);
|
|
122
|
+
}));
|
|
123
|
+
|
|
124
|
+
function viewFieatureHasExpectedDependencies() {
|
|
125
|
+
return _viewFieatureHasExpectedDependencies.apply(this, arguments);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return viewFieatureHasExpectedDependencies;
|
|
129
|
+
}()
|
|
130
|
+
}, {
|
|
131
|
+
key: "asksIfRootSkillViewIfNotYetCreated",
|
|
132
|
+
value: function () {
|
|
133
|
+
var _asksIfRootSkillViewIfNotYetCreated = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3() {
|
|
134
|
+
var last;
|
|
135
|
+
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
136
|
+
while (1) {
|
|
137
|
+
switch (_context3.prev = _context3.next) {
|
|
97
138
|
case 0:
|
|
98
139
|
void this.action.execute({
|
|
99
140
|
viewType: 'skillView'
|
|
100
141
|
});
|
|
101
|
-
|
|
142
|
+
_context3.next = 3;
|
|
102
143
|
return this.waitForInput();
|
|
103
144
|
|
|
104
145
|
case 3:
|
|
@@ -110,10 +151,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
110
151
|
|
|
111
152
|
case 6:
|
|
112
153
|
case "end":
|
|
113
|
-
return
|
|
154
|
+
return _context3.stop();
|
|
114
155
|
}
|
|
115
156
|
}
|
|
116
|
-
},
|
|
157
|
+
}, _callee3, this);
|
|
117
158
|
}));
|
|
118
159
|
|
|
119
160
|
function asksIfRootSkillViewIfNotYetCreated() {
|
|
@@ -125,20 +166,20 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
125
166
|
}, {
|
|
126
167
|
key: "canCreateRootSkillView",
|
|
127
168
|
value: function () {
|
|
128
|
-
var _canCreateRootSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
169
|
+
var _canCreateRootSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4() {
|
|
129
170
|
var results;
|
|
130
|
-
return _regenerator["default"].wrap(function
|
|
171
|
+
return _regenerator["default"].wrap(function _callee4$(_context4) {
|
|
131
172
|
while (1) {
|
|
132
|
-
switch (
|
|
173
|
+
switch (_context4.prev = _context4.next) {
|
|
133
174
|
case 0:
|
|
134
|
-
|
|
175
|
+
_context4.next = 2;
|
|
135
176
|
return this.action.execute({
|
|
136
177
|
viewType: 'skillView',
|
|
137
178
|
isRoot: true
|
|
138
179
|
});
|
|
139
180
|
|
|
140
181
|
case 2:
|
|
141
|
-
results =
|
|
182
|
+
results = _context4.sent;
|
|
142
183
|
|
|
143
184
|
_test.assert.isFalsy(results.errors);
|
|
144
185
|
|
|
@@ -148,10 +189,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
148
189
|
|
|
149
190
|
case 6:
|
|
150
191
|
case "end":
|
|
151
|
-
return
|
|
192
|
+
return _context4.stop();
|
|
152
193
|
}
|
|
153
194
|
}
|
|
154
|
-
},
|
|
195
|
+
}, _callee4, this);
|
|
155
196
|
}));
|
|
156
197
|
|
|
157
198
|
function canCreateRootSkillView() {
|
|
@@ -163,20 +204,20 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
163
204
|
}, {
|
|
164
205
|
key: "generatesValidRootSkillView",
|
|
165
206
|
value: function () {
|
|
166
|
-
var _generatesValidRootSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
167
|
-
return _regenerator["default"].wrap(function
|
|
207
|
+
var _generatesValidRootSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5() {
|
|
208
|
+
return _regenerator["default"].wrap(function _callee5$(_context5) {
|
|
168
209
|
while (1) {
|
|
169
|
-
switch (
|
|
210
|
+
switch (_context5.prev = _context5.next) {
|
|
170
211
|
case 0:
|
|
171
|
-
|
|
212
|
+
_context5.next = 2;
|
|
172
213
|
return this.Service('typeChecker').check(this.rootSvc);
|
|
173
214
|
|
|
174
215
|
case 2:
|
|
175
216
|
case "end":
|
|
176
|
-
return
|
|
217
|
+
return _context5.stop();
|
|
177
218
|
}
|
|
178
219
|
}
|
|
179
|
-
},
|
|
220
|
+
}, _callee5, this);
|
|
180
221
|
}));
|
|
181
222
|
|
|
182
223
|
function generatesValidRootSkillView() {
|
|
@@ -188,11 +229,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
188
229
|
}, {
|
|
189
230
|
key: "rootSkillViewExtendsAbstractSkillViewController",
|
|
190
231
|
value: function () {
|
|
191
|
-
var _rootSkillViewExtendsAbstractSkillViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
232
|
+
var _rootSkillViewExtendsAbstractSkillViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6() {
|
|
192
233
|
var contents;
|
|
193
|
-
return _regenerator["default"].wrap(function
|
|
234
|
+
return _regenerator["default"].wrap(function _callee6$(_context6) {
|
|
194
235
|
while (1) {
|
|
195
|
-
switch (
|
|
236
|
+
switch (_context6.prev = _context6.next) {
|
|
196
237
|
case 0:
|
|
197
238
|
contents = _spruceSkillUtils.diskUtil.readFile(this.rootSvc);
|
|
198
239
|
|
|
@@ -200,10 +241,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
200
241
|
|
|
201
242
|
case 2:
|
|
202
243
|
case "end":
|
|
203
|
-
return
|
|
244
|
+
return _context6.stop();
|
|
204
245
|
}
|
|
205
246
|
}
|
|
206
|
-
},
|
|
247
|
+
}, _callee6, this);
|
|
207
248
|
}));
|
|
208
249
|
|
|
209
250
|
function rootSkillViewExtendsAbstractSkillViewController() {
|
|
@@ -215,22 +256,22 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
215
256
|
}, {
|
|
216
257
|
key: "cantCreateTwoRootSvcs",
|
|
217
258
|
value: function () {
|
|
218
|
-
var _cantCreateTwoRootSvcs = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
259
|
+
var _cantCreateTwoRootSvcs = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7() {
|
|
219
260
|
var _results$errors;
|
|
220
261
|
|
|
221
262
|
var results;
|
|
222
|
-
return _regenerator["default"].wrap(function
|
|
263
|
+
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
223
264
|
while (1) {
|
|
224
|
-
switch (
|
|
265
|
+
switch (_context7.prev = _context7.next) {
|
|
225
266
|
case 0:
|
|
226
|
-
|
|
267
|
+
_context7.next = 2;
|
|
227
268
|
return this.action.execute({
|
|
228
269
|
viewType: 'skillView',
|
|
229
270
|
isRoot: true
|
|
230
271
|
});
|
|
231
272
|
|
|
232
273
|
case 2:
|
|
233
|
-
results =
|
|
274
|
+
results = _context7.sent;
|
|
234
275
|
|
|
235
276
|
_test.assert.isTruthy(results.errors);
|
|
236
277
|
|
|
@@ -240,10 +281,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
240
281
|
|
|
241
282
|
case 5:
|
|
242
283
|
case "end":
|
|
243
|
-
return
|
|
284
|
+
return _context7.stop();
|
|
244
285
|
}
|
|
245
286
|
}
|
|
246
|
-
},
|
|
287
|
+
}, _callee7, this);
|
|
247
288
|
}));
|
|
248
289
|
|
|
249
290
|
function cantCreateTwoRootSvcs() {
|
|
@@ -255,16 +296,16 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
255
296
|
}, {
|
|
256
297
|
key: "asksForNamesIfCreatingSkillViewNotRoot",
|
|
257
298
|
value: function () {
|
|
258
|
-
var _asksForNamesIfCreatingSkillViewNotRoot = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
299
|
+
var _asksForNamesIfCreatingSkillViewNotRoot = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8() {
|
|
259
300
|
var promise, last, results;
|
|
260
|
-
return _regenerator["default"].wrap(function
|
|
301
|
+
return _regenerator["default"].wrap(function _callee8$(_context8) {
|
|
261
302
|
while (1) {
|
|
262
|
-
switch (
|
|
303
|
+
switch (_context8.prev = _context8.next) {
|
|
263
304
|
case 0:
|
|
264
305
|
promise = this.action.execute({
|
|
265
306
|
viewType: 'skillView'
|
|
266
307
|
});
|
|
267
|
-
|
|
308
|
+
_context8.next = 3;
|
|
268
309
|
return this.waitForInput();
|
|
269
310
|
|
|
270
311
|
case 3:
|
|
@@ -272,19 +313,19 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
272
313
|
|
|
273
314
|
_test.assert.isEqual(last.command, 'prompt');
|
|
274
315
|
|
|
275
|
-
|
|
316
|
+
_context8.next = 7;
|
|
276
317
|
return this.ui.sendInput('Dashboard');
|
|
277
318
|
|
|
278
319
|
case 7:
|
|
279
|
-
|
|
320
|
+
_context8.next = 9;
|
|
280
321
|
return this.ui.sendInput('\n');
|
|
281
322
|
|
|
282
323
|
case 9:
|
|
283
|
-
|
|
324
|
+
_context8.next = 11;
|
|
284
325
|
return promise;
|
|
285
326
|
|
|
286
327
|
case 11:
|
|
287
|
-
results =
|
|
328
|
+
results = _context8.sent;
|
|
288
329
|
|
|
289
330
|
_test.assert.isFalsy(results.errors);
|
|
290
331
|
|
|
@@ -296,10 +337,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
296
337
|
|
|
297
338
|
case 16:
|
|
298
339
|
case "end":
|
|
299
|
-
return
|
|
340
|
+
return _context8.stop();
|
|
300
341
|
}
|
|
301
342
|
}
|
|
302
|
-
},
|
|
343
|
+
}, _callee8, this);
|
|
303
344
|
}));
|
|
304
345
|
|
|
305
346
|
function asksForNamesIfCreatingSkillViewNotRoot() {
|
|
@@ -311,17 +352,17 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
311
352
|
}, {
|
|
312
353
|
key: "asksForViewModelWhenCreatingSkillView",
|
|
313
354
|
value: function () {
|
|
314
|
-
var _asksForViewModelWhenCreatingSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
355
|
+
var _asksForViewModelWhenCreatingSkillView = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9() {
|
|
315
356
|
var promise, last, results;
|
|
316
|
-
return _regenerator["default"].wrap(function
|
|
357
|
+
return _regenerator["default"].wrap(function _callee9$(_context9) {
|
|
317
358
|
while (1) {
|
|
318
|
-
switch (
|
|
359
|
+
switch (_context9.prev = _context9.next) {
|
|
319
360
|
case 0:
|
|
320
361
|
promise = this.action.execute({
|
|
321
362
|
viewType: 'view',
|
|
322
363
|
nameReadable: 'Appointments card'
|
|
323
364
|
});
|
|
324
|
-
|
|
365
|
+
_context9.next = 3;
|
|
325
366
|
return this.waitForInput();
|
|
326
367
|
|
|
327
368
|
case 3:
|
|
@@ -333,15 +374,15 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
333
374
|
value: 'Card'
|
|
334
375
|
});
|
|
335
376
|
|
|
336
|
-
|
|
377
|
+
_context9.next = 8;
|
|
337
378
|
return this.ui.sendInput('Card');
|
|
338
379
|
|
|
339
380
|
case 8:
|
|
340
|
-
|
|
381
|
+
_context9.next = 10;
|
|
341
382
|
return promise;
|
|
342
383
|
|
|
343
384
|
case 10:
|
|
344
|
-
results =
|
|
385
|
+
results = _context9.sent;
|
|
345
386
|
|
|
346
387
|
_test.assert.isFalsy(results.errors);
|
|
347
388
|
|
|
@@ -349,10 +390,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
349
390
|
|
|
350
391
|
case 13:
|
|
351
392
|
case "end":
|
|
352
|
-
return
|
|
393
|
+
return _context9.stop();
|
|
353
394
|
}
|
|
354
395
|
}
|
|
355
|
-
},
|
|
396
|
+
}, _callee9, this);
|
|
356
397
|
}));
|
|
357
398
|
|
|
358
399
|
function asksForViewModelWhenCreatingSkillView() {
|
|
@@ -371,11 +412,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
371
412
|
}, {
|
|
372
413
|
key: "nicelyTypesRootSkillViewController",
|
|
373
414
|
value: function () {
|
|
374
|
-
var _nicelyTypesRootSkillViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
415
|
+
var _nicelyTypesRootSkillViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10() {
|
|
375
416
|
var contents, testFile, imported;
|
|
376
|
-
return _regenerator["default"].wrap(function
|
|
417
|
+
return _regenerator["default"].wrap(function _callee10$(_context10) {
|
|
377
418
|
while (1) {
|
|
378
|
-
switch (
|
|
419
|
+
switch (_context10.prev = _context10.next) {
|
|
379
420
|
case 0:
|
|
380
421
|
contents = this.buildTestfile({
|
|
381
422
|
idInterfaceName: 'SkillViewControllerId',
|
|
@@ -385,11 +426,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
385
426
|
|
|
386
427
|
_spruceSkillUtils.diskUtil.writeFile(testFile, contents);
|
|
387
428
|
|
|
388
|
-
|
|
429
|
+
_context10.next = 5;
|
|
389
430
|
return this.Service('import').importAll(testFile);
|
|
390
431
|
|
|
391
432
|
case 5:
|
|
392
|
-
imported =
|
|
433
|
+
imported = _context10.sent;
|
|
393
434
|
|
|
394
435
|
_test.assert.isTruthy(imported.svcModel);
|
|
395
436
|
|
|
@@ -397,10 +438,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
397
438
|
|
|
398
439
|
case 8:
|
|
399
440
|
case "end":
|
|
400
|
-
return
|
|
441
|
+
return _context10.stop();
|
|
401
442
|
}
|
|
402
443
|
}
|
|
403
|
-
},
|
|
444
|
+
}, _callee10, this);
|
|
404
445
|
}));
|
|
405
446
|
|
|
406
447
|
function nicelyTypesRootSkillViewController() {
|
|
@@ -412,11 +453,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
412
453
|
}, {
|
|
413
454
|
key: "nicelyTypesViewController",
|
|
414
455
|
value: function () {
|
|
415
|
-
var _nicelyTypesViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
456
|
+
var _nicelyTypesViewController = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee11() {
|
|
416
457
|
var contents, testFile, imported;
|
|
417
|
-
return _regenerator["default"].wrap(function
|
|
458
|
+
return _regenerator["default"].wrap(function _callee11$(_context11) {
|
|
418
459
|
while (1) {
|
|
419
|
-
switch (
|
|
460
|
+
switch (_context11.prev = _context11.next) {
|
|
420
461
|
case 0:
|
|
421
462
|
contents = this.buildTestfile({
|
|
422
463
|
idInterfaceName: 'ViewControllerId',
|
|
@@ -426,11 +467,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
426
467
|
|
|
427
468
|
_spruceSkillUtils.diskUtil.writeFile(testFile, contents);
|
|
428
469
|
|
|
429
|
-
|
|
470
|
+
_context11.next = 5;
|
|
430
471
|
return this.Service('import').importAll(testFile);
|
|
431
472
|
|
|
432
473
|
case 5:
|
|
433
|
-
imported =
|
|
474
|
+
imported = _context11.sent;
|
|
434
475
|
|
|
435
476
|
_test.assert.isTruthy(imported.vcModel);
|
|
436
477
|
|
|
@@ -438,10 +479,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
438
479
|
|
|
439
480
|
case 8:
|
|
440
481
|
case "end":
|
|
441
|
-
return
|
|
482
|
+
return _context11.stop();
|
|
442
483
|
}
|
|
443
484
|
}
|
|
444
|
-
},
|
|
485
|
+
}, _callee11, this);
|
|
445
486
|
}));
|
|
446
487
|
|
|
447
488
|
function nicelyTypesViewController() {
|
|
@@ -453,11 +494,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
453
494
|
}, {
|
|
454
495
|
key: "typesViewControllerOptions",
|
|
455
496
|
value: function () {
|
|
456
|
-
var _typesViewControllerOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
497
|
+
var _typesViewControllerOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
457
498
|
var viewsFile, viewContents;
|
|
458
|
-
return _regenerator["default"].wrap(function
|
|
499
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
459
500
|
while (1) {
|
|
460
|
-
switch (
|
|
501
|
+
switch (_context12.prev = _context12.next) {
|
|
461
502
|
case 0:
|
|
462
503
|
viewsFile = this.resolveHashSprucePath('views', 'views.ts');
|
|
463
504
|
viewContents = _spruceSkillUtils.diskUtil.readFile(viewsFile);
|
|
@@ -468,10 +509,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
468
509
|
|
|
469
510
|
case 4:
|
|
470
511
|
case "end":
|
|
471
|
-
return
|
|
512
|
+
return _context12.stop();
|
|
472
513
|
}
|
|
473
514
|
}
|
|
474
|
-
},
|
|
515
|
+
}, _callee12, this);
|
|
475
516
|
}));
|
|
476
517
|
|
|
477
518
|
function typesViewControllerOptions() {
|
|
@@ -483,11 +524,11 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
483
524
|
}, {
|
|
484
525
|
key: "typesSkillViewControllerLoadOptionsOptions",
|
|
485
526
|
value: function () {
|
|
486
|
-
var _typesSkillViewControllerLoadOptionsOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
527
|
+
var _typesSkillViewControllerLoadOptionsOptions = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
487
528
|
var viewsFile, viewContents;
|
|
488
|
-
return _regenerator["default"].wrap(function
|
|
529
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
489
530
|
while (1) {
|
|
490
|
-
switch (
|
|
531
|
+
switch (_context13.prev = _context13.next) {
|
|
491
532
|
case 0:
|
|
492
533
|
viewsFile = this.resolveHashSprucePath('views', 'views.ts');
|
|
493
534
|
viewContents = _spruceSkillUtils.diskUtil.readFile(viewsFile);
|
|
@@ -500,10 +541,10 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
500
541
|
|
|
501
542
|
case 5:
|
|
502
543
|
case "end":
|
|
503
|
-
return
|
|
544
|
+
return _context13.stop();
|
|
504
545
|
}
|
|
505
546
|
}
|
|
506
|
-
},
|
|
547
|
+
}, _callee13, this);
|
|
507
548
|
}));
|
|
508
549
|
|
|
509
550
|
function typesSkillViewControllerLoadOptionsOptions() {
|
|
@@ -521,6 +562,6 @@ var CreatingASkillViewTest = (_dec = (0, _test.test)(), _dec2 = (0, _test.test)(
|
|
|
521
562
|
}
|
|
522
563
|
}]);
|
|
523
564
|
return CreatingASkillViewTest;
|
|
524
|
-
}(_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), _class2), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "
|
|
565
|
+
}(_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), _class2), ((0, _applyDecoratedDescriptor2["default"])(_class, "hasCreateAction", [_dec], Object.getOwnPropertyDescriptor(_class, "hasCreateAction"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "viewFieatureHasExpectedDependencies", [_dec2], Object.getOwnPropertyDescriptor(_class, "viewFieatureHasExpectedDependencies"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksIfRootSkillViewIfNotYetCreated", [_dec3], Object.getOwnPropertyDescriptor(_class, "asksIfRootSkillViewIfNotYetCreated"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canCreateRootSkillView", [_dec4], Object.getOwnPropertyDescriptor(_class, "canCreateRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "generatesValidRootSkillView", [_dec5], Object.getOwnPropertyDescriptor(_class, "generatesValidRootSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "rootSkillViewExtendsAbstractSkillViewController", [_dec6], Object.getOwnPropertyDescriptor(_class, "rootSkillViewExtendsAbstractSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "cantCreateTwoRootSvcs", [_dec7], Object.getOwnPropertyDescriptor(_class, "cantCreateTwoRootSvcs"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForNamesIfCreatingSkillViewNotRoot", [_dec8], Object.getOwnPropertyDescriptor(_class, "asksForNamesIfCreatingSkillViewNotRoot"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksForViewModelWhenCreatingSkillView", [_dec9], Object.getOwnPropertyDescriptor(_class, "asksForViewModelWhenCreatingSkillView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "skillViewExtendsAbstractViewControllerWithProperView", [_dec10], Object.getOwnPropertyDescriptor(_class, "skillViewExtendsAbstractViewControllerWithProperView"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesRootSkillViewController", [_dec11], Object.getOwnPropertyDescriptor(_class, "nicelyTypesRootSkillViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "nicelyTypesViewController", [_dec12], Object.getOwnPropertyDescriptor(_class, "nicelyTypesViewController"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "typesViewControllerOptions", [_dec13], Object.getOwnPropertyDescriptor(_class, "typesViewControllerOptions"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "typesSkillViewControllerLoadOptionsOptions", [_dec14], Object.getOwnPropertyDescriptor(_class, "typesSkillViewControllerLoadOptionsOptions"), _class)), _class));
|
|
525
566
|
exports["default"] = CreatingASkillViewTest;
|
|
526
567
|
//# sourceMappingURL=CreatingASkillView.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreatingASkillView.test.js","names":["CreatingASkillViewTest","action","Action","assert","isFunction","execute","viewType","waitForInput","last","ui","getLastInvocation","isEqual","command","reset","isRoot","results","isFalsy","errors","rootSvc","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","Service","check","contents","diskUtil","readFile","isTruthy","errorAssert","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"],"sources":["../../../../src/__tests__/behavioral/views/CreatingASkillView.test.ts"],"sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssert } 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.getLastInvocation()\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\terrorAssert.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.getLastInvocation()\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.getLastInvocation()\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\t@test()\n\tprotected static async typesSkillViewControllerLoadOptionsOptions() {\n\t\tconst viewsFile = this.resolveHashSprucePath('views', 'views.ts')\n\t\tconst viewContents = diskUtil.readFile(viewsFile)\n\n\t\tassert.doesInclude(viewContents, `interface SkillViewControllerArgsMap`)\n\t\tassert.doesInclude(\n\t\t\tviewContents,\n\t\t\t`type LoadOptions<Args extends Record<string,any>[]> = Args[0]['args'] extends Record<string, any> ? Args[0]['args'] : Record<never, any>`\n\t\t)\n\t\tassert.doesInclude(\n\t\t\tviewContents,\n\t\t\t`'testing-views.root': LoadOptions<Parameters<RootSkillViewController['load']>>`\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"],"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,WAYA,iB;;;;;;;;;;;;;sGA1LD;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA;;cAAA;gBAEC,KAAKC,MAAL,GAAc,KAAKC,MAAL,CAAY,MAAZ,EAAoB,QAApB,CAAd;;cAFD;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAKA,2BACmC;MAClCC,aAAOC,UAAP,CAAkB,KAAKH,MAAL,CAAYI,OAA9B;IACA;;;;8HAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBAEC,KAAK,KAAKJ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CAHtB;;gBAKCjD,aAAOmB,WAAP,CAAmBgC,YAAnB;;gBACAnD,aAAOmB,WAAP,CACCgC,YADD;;gBAIAnD,aAAOmB,WAAP,CACCgC,YADD;;cAVD;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAgBA,uBAA6BlB,OAA7B,EAGG;MACF,IAAQM,IAAR,GAAkCN,OAAlC,CAAQM,IAAR;MAAA,IAAcD,eAAd,GAAkCL,OAAlC,CAAcK,eAAd;MAEA,OACC,cAEA,6GAKAA,eALA,mYAiBDC,IAjBC,YAkBCa,IAlBD,EAHD;IAuBA;;;EA9OkDC,8B,8DAClB,O"}
|
|
1
|
+
{"version":3,"file":"CreatingASkillView.test.js","names":["CreatingASkillViewTest","action","Action","assert","isFunction","execute","getFeatureInstaller","features","view","getFeature","isEqualDeep","dependencies","code","isRequired","viewType","waitForInput","last","ui","getLastInvocation","isEqual","command","reset","isRoot","results","isFalsy","errors","rootSvc","testUtil","assertFileByNameInGeneratedFiles","files","doesInclude","Service","check","contents","diskUtil","readFile","isTruthy","errorAssert","assertError","name","promise","sendInput","dashboardVc","nameReadable","options","choices","value","appointmentsCard","buildTestfile","idInterfaceName","testFile","resolvePath","writeFile","importAll","imported","svcModel","svcId","vcModel","vcId","viewsFile","resolveHashSprucePath","viewContents","trim","AbstractSkillTest"],"sources":["../../../../src/__tests__/behavioral/views/CreatingASkillView.test.ts"],"sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssert } 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 viewFieatureHasExpectedDependencies() {\n\t\tconst features = await this.getFeatureInstaller()\n\t\tconst view = features.getFeature('view')\n\t\tassert.isEqualDeep(view.dependencies, [\n\t\t\t{\n\t\t\t\tcode: 'node',\n\t\t\t\tisRequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcode: 'schema',\n\t\t\t\tisRequired: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tcode: 'event',\n\t\t\t\tisRequired: true,\n\t\t\t},\n\t\t])\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.getLastInvocation()\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\terrorAssert.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.getLastInvocation()\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.getLastInvocation()\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\t@test()\n\tprotected static async typesSkillViewControllerLoadOptionsOptions() {\n\t\tconst viewsFile = this.resolveHashSprucePath('views', 'views.ts')\n\t\tconst viewContents = diskUtil.readFile(viewsFile)\n\n\t\tassert.doesInclude(viewContents, `interface SkillViewControllerArgsMap`)\n\t\tassert.doesInclude(\n\t\t\tviewContents,\n\t\t\t`type LoadOptions<Args extends Record<string,any>[]> = Args[0]['args'] extends Record<string, any> ? Args[0]['args'] : Record<never, any>`\n\t\t)\n\t\tassert.doesInclude(\n\t\t\tviewContents,\n\t\t\t`'testing-views.root': LoadOptions<Parameters<RootSkillViewController['load']>>`\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"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;IAEqBA,sB,WAYnB,iB,UAKA,iB,UAoBA,iB,UAeA,iB,UAiBA,iB,UAKA,iB,UASA,iB,UAcA,iB,UA6BA,iB,WA4BA,iB,WASA,iB,WAmBA,iB,WAmBA,iB,WAYA,iB;;;;;;;;;;;;;sGA9MD;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA;;cAAA;gBAEC,KAAKC,MAAL,GAAc,KAAKC,MAAL,CAAY,MAAZ,EAAoB,QAApB,CAAd;;cAFD;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAKA,2BACmC;MAClCC,aAAOC,UAAP,CAAkB,KAAKH,MAAL,CAAYI,OAA9B;I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BkB,QAAQ,CAACI,IAAzB;;cAhBD;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;sHAmBA;QAAA;QAAA;UAAA;YAAA;cAAA;gBAEOC,SAFP,GAEmB,KAAKC,qBAAL,CAA2B,OAA3B,EAAoC,UAApC,CAFnB;gBAGOC,YAHP,GAGsB3B,2BAASC,QAAT,CAAkBwB,SAAlB,CAHtB;;gBAKCxD,aAAO2B,WAAP,CAAmB+B,YAAnB;;gBACA1D,aAAO2B,WAAP,CACC+B,YADD;;cAND;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;;sIAYA;QAAA;QAAA;UAAA;YAAA;cAAA;gBAEOF,SAFP,GAEmB,KAAKC,qBAAL,CAA2B,OAA3B,EAAoC,UAApC,CAFnB;gBAGOC,YAHP,GAGsB3B,2BAASC,QAAT,CAAkBwB,SAAlB,CAHtB;;gBAKCxD,aAAO2B,WAAP,CAAmB+B,YAAnB;;gBACA1D,aAAO2B,WAAP,CACC+B,YADD;;gBAIA1D,aAAO2B,WAAP,CACC+B,YADD;;cAVD;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;WAgBA,uBAA6BjB,OAA7B,EAGG;MACF,IAAQhC,IAAR,GAAkCgC,OAAlC,CAAQhC,IAAR;MAAA,IAAcqC,eAAd,GAAkCL,OAAlC,CAAcK,eAAd;MAEA,OACC,cAEA,6GAKAA,eALA,mYAiBDrC,IAjBC,YAkBCkD,IAlBD,EAHD;IAuBA;;;EAlQkDC,8B,8DAClB,O"}
|
|
@@ -53,7 +53,7 @@ var ViewFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
53
53
|
name: '@sprucelabs/spruce-view-plugin@latest'
|
|
54
54
|
}]);
|
|
55
55
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "dependencies", [{
|
|
56
|
-
code: '
|
|
56
|
+
code: 'node',
|
|
57
57
|
isRequired: true
|
|
58
58
|
}, {
|
|
59
59
|
code: 'schema',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ViewFeature.js","names":["ViewFeature","options","diskUtil","resolvePath","__dirname","name","code","isRequired","emitter","on","payload","featureCode","actionCode","featureInstaller","isInstalled","Writer","writePlugin","cwd","files","abstractClasses","label","Service","add","id","namespace","AbstractFeature"],"sources":["../../../src/features/view/ViewFeature.ts"],"sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { NpmPackage } from '../../types/cli.types'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport { ActionOptions, FeatureCode } from '../features.types'\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tview: ViewFeature\n\t}\n\n\tinterface FeatureOptionsMap {\n\t\tview: undefined\n\t}\n}\n\nexport default class ViewFeature extends AbstractFeature {\n\tpublic nameReadable = 'views'\n\tpublic description = 'Views: Create views using the Heartwood framework.'\n\tpublic code: FeatureCode = 'view'\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic readonly packageDependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: '@sprucelabs/heartwood-view-controllers@latest',\n\t\t},\n\t\t{\n\t\t\tname: '@sprucelabs/spruce-view-plugin@latest',\n\t\t},\n\t]\n\n\tpublic dependencies: FeatureDependency[] = [\n\t\t{\n\t\t\tcode: '
|
|
1
|
+
{"version":3,"file":"ViewFeature.js","names":["ViewFeature","options","diskUtil","resolvePath","__dirname","name","code","isRequired","emitter","on","payload","featureCode","actionCode","featureInstaller","isInstalled","Writer","writePlugin","cwd","files","abstractClasses","label","Service","add","id","namespace","AbstractFeature"],"sources":["../../../src/features/view/ViewFeature.ts"],"sourcesContent":["import { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport { NpmPackage } from '../../types/cli.types'\nimport AbstractFeature, { FeatureDependency } from '../AbstractFeature'\nimport { ActionOptions, FeatureCode } from '../features.types'\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tview: ViewFeature\n\t}\n\n\tinterface FeatureOptionsMap {\n\t\tview: undefined\n\t}\n}\n\nexport default class ViewFeature extends AbstractFeature {\n\tpublic nameReadable = 'views'\n\tpublic description = 'Views: Create views using the Heartwood framework.'\n\tpublic code: FeatureCode = 'view'\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\n\tpublic readonly packageDependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: '@sprucelabs/heartwood-view-controllers@latest',\n\t\t},\n\t\t{\n\t\t\tname: '@sprucelabs/spruce-view-plugin@latest',\n\t\t},\n\t]\n\n\tpublic dependencies: FeatureDependency[] = [\n\t\t{\n\t\t\tcode: 'node',\n\t\t\tisRequired: true,\n\t\t},\n\t\t{\n\t\t\tcode: 'schema',\n\t\t\tisRequired: true,\n\t\t},\n\t\t{\n\t\t\tcode: 'event',\n\t\t\tisRequired: true,\n\t\t},\n\t]\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\n\t\tvoid this.emitter.on('feature.did-execute', async (payload) => {\n\t\t\tconst { featureCode, actionCode } = payload\n\t\t\tconst isInstalled = await this.featureInstaller.isInstalled('view')\n\n\t\t\tif (isInstalled && featureCode === 'node' && actionCode === 'upgrade') {\n\t\t\t\tconst files = await this.Writer('view').writePlugin(this.cwd)\n\t\t\t\treturn {\n\t\t\t\t\tfiles,\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {}\n\t\t})\n\n\t\tvoid this.emitter.on('test.register-abstract-test-classes', async () => {\n\t\t\treturn {\n\t\t\t\tabstractClasses: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'AbstractViewControllerTest',\n\t\t\t\t\t\tlabel: 'AbstractViewControllerTest',\n\t\t\t\t\t\timport: '@sprucelabs/spruce-view-plugin',\n\t\t\t\t\t\tfeatureCode: 'view',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t}\n\t\t})\n\t}\n\n\tpublic async afterPackageInstall() {\n\t\tconst files = await this.Writer('view').writePlugin(this.cwd)\n\n\t\tthis.Service('dependency').add({\n\t\t\tid: '**',\n\t\t\tnamespace: 'heartwood',\n\t\t})\n\n\t\treturn { files }\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;IAaqBA,W;;;;;EA8BpB,qBAAmBC,OAAnB,EAA2C;IAAA;;IAAA;IAC1C,0BAAMA,OAAN;IAD0C,iGA7BrB,OA6BqB;IAAA,gGA5BtB,oDA4BsB;IAAA,yFA3BhB,MA2BgB;IAAA,+FA1BvBC,2BAASC,WAAT,CAAqBC,SAArB,EAAgC,SAAhC,CA0BuB;IAAA,wGAxBS,CACnD;MACCC,IAAI,EAAE;IADP,CADmD,EAInD;MACCA,IAAI,EAAE;IADP,CAJmD,CAwBT;IAAA,iGAfA,CAC1C;MACCC,IAAI,EAAE,MADP;MAECC,UAAU,EAAE;IAFb,CAD0C,EAK1C;MACCD,IAAI,EAAE,QADP;MAECC,UAAU,EAAE;IAFb,CAL0C,EAS1C;MACCD,IAAI,EAAE,OADP;MAECC,UAAU,EAAE;IAFb,CAT0C,CAeA;IAG1C,KAAK,MAAKC,OAAL,CAAaC,EAAb,CAAgB,qBAAhB;MAAA,yFAAuC,iBAAOC,OAAP;QAAA;QAAA;UAAA;YAAA;cAAA;gBACnCC,WADmC,GACPD,OADO,CACnCC,WADmC,EACtBC,UADsB,GACPF,OADO,CACtBE,UADsB;gBAAA;gBAAA,OAEjB,MAAKC,gBAAL,CAAsBC,WAAtB,CAAkC,MAAlC,CAFiB;;cAAA;gBAErCA,WAFqC;;gBAAA,MAIvCA,WAAW,IAAIH,WAAW,KAAK,MAA/B,IAAyCC,UAAU,KAAK,SAJjB;kBAAA;kBAAA;gBAAA;;gBAAA;gBAAA,OAKtB,MAAKG,MAAL,CAAY,MAAZ,EAAoBC,WAApB,CAAgC,MAAKC,GAArC,CALsB;;cAAA;gBAKpCC,KALoC;gBAAA,iCAMnC;kBACNA,KAAK,EAALA;gBADM,CANmC;;cAAA;gBAAA,iCAUpC,EAVoC;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CAAvC;;MAAA;QAAA;MAAA;IAAA,IAAL;IAaA,KAAK,MAAKV,OAAL,CAAaC,EAAb,CAAgB,qCAAhB,6FAAuD;MAAA;QAAA;UAAA;YAAA;cAAA,kCACpD;gBACNU,eAAe,EAAE,CAChB;kBACCd,IAAI,EAAE,4BADP;kBAECe,KAAK,EAAE,4BAFR;kBAGC,UAAQ,gCAHT;kBAICT,WAAW,EAAE;gBAJd,CADgB;cADX,CADoD;;YAAA;YAAA;cAAA;UAAA;QAAA;MAAA;IAAA,CAAvD,GAAL;IAhB0C;EA4B1C;;;;;+GAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACqB,KAAKI,MAAL,CAAY,MAAZ,EAAoBC,WAApB,CAAgC,KAAKC,GAArC,CADrB;;cAAA;gBACOC,KADP;gBAGC,KAAKG,OAAL,CAAa,YAAb,EAA2BC,GAA3B,CAA+B;kBAC9BC,EAAE,EAAE,IAD0B;kBAE9BC,SAAS,EAAE;gBAFmB,CAA/B;gBAHD,kCAQQ;kBAAEN,KAAK,EAALA;gBAAF,CARR;;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,C;;;;;;;;;;EA5DwCO,4B"}
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
]
|
|
19
19
|
},
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"version": "15.4.
|
|
21
|
+
"version": "15.4.9",
|
|
22
22
|
"bin": {
|
|
23
23
|
"spruce": "./build/index.js"
|
|
24
24
|
},
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"@sprucelabs/spruce-event-utils": "^20.1.7",
|
|
89
89
|
"@sprucelabs/spruce-skill-booter": "^31.0.12",
|
|
90
90
|
"@sprucelabs/spruce-skill-utils": "^26.0.5",
|
|
91
|
-
"@sprucelabs/spruce-templates": "^15.4.
|
|
91
|
+
"@sprucelabs/spruce-templates": "^15.4.9",
|
|
92
92
|
"@typescript-eslint/eslint-plugin": "^5.17.0",
|
|
93
93
|
"@typescript-eslint/parser": "^5.17.0",
|
|
94
94
|
"cfonts": "^2.10.1",
|
|
@@ -597,5 +597,5 @@
|
|
|
597
597
|
"terminal-kit"
|
|
598
598
|
]
|
|
599
599
|
},
|
|
600
|
-
"gitHead": "
|
|
600
|
+
"gitHead": "ae6412c0774221a55a1c0f20540c8b657e0a1230"
|
|
601
601
|
}
|
|
@@ -22,6 +22,26 @@ export default class CreatingASkillViewTest extends AbstractSkillTest {
|
|
|
22
22
|
assert.isFunction(this.action.execute)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
+
@test()
|
|
26
|
+
protected static async viewFieatureHasExpectedDependencies() {
|
|
27
|
+
const features = await this.getFeatureInstaller()
|
|
28
|
+
const view = features.getFeature('view')
|
|
29
|
+
assert.isEqualDeep(view.dependencies, [
|
|
30
|
+
{
|
|
31
|
+
code: 'node',
|
|
32
|
+
isRequired: true,
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
code: 'schema',
|
|
36
|
+
isRequired: true,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
code: 'event',
|
|
40
|
+
isRequired: true,
|
|
41
|
+
},
|
|
42
|
+
])
|
|
43
|
+
}
|
|
44
|
+
|
|
25
45
|
@test()
|
|
26
46
|
protected static async asksIfRootSkillViewIfNotYetCreated() {
|
|
27
47
|
void this.action.execute({
|