@projectcaluma/ember-testing 11.0.0-beta.1 → 11.0.0-beta.4
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 +21 -0
- package/addon/mirage-graphql/filters/form.js +4 -0
- package/addon/mirage-graphql/mocks/answer.js +2 -8
- package/addon/mirage-graphql/mocks/work-item.js +2 -2
- package/addon/scenarios/distribution.js +65 -29
- package/addon-mirage-support/factories/answer.js +2 -8
- package/addon-mirage-support/factories/form.js +1 -0
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
# [@projectcaluma/ember-testing-v11.0.0-beta.4](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v11.0.0-beta.3...@projectcaluma/ember-testing-v11.0.0-beta.4) (2022-03-11)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **form-builder:** add new categories published and unpublished ([52c1c1d](https://github.com/projectcaluma/ember-caluma/commit/52c1c1deaf15991e595e042f643889be64b425a0))
|
|
7
|
+
|
|
8
|
+
# [@projectcaluma/ember-testing-v11.0.0-beta.3](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v11.0.0-beta.2...@projectcaluma/ember-testing-v11.0.0-beta.3) (2022-02-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **distribution:** add index page when no inquiries exist ([689089c](https://github.com/projectcaluma/ember-caluma/commit/689089c8f28146a33346f382fe69e7ca1b588d97))
|
|
14
|
+
|
|
15
|
+
# [@projectcaluma/ember-testing-v11.0.0-beta.2](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v11.0.0-beta.1...@projectcaluma/ember-testing-v11.0.0-beta.2) (2022-02-07)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **testing:** replace moment with luxon ([893c6f4](https://github.com/projectcaluma/ember-caluma/commit/893c6f4a907a65f5e55eab72c09b7703c780a3a5))
|
|
21
|
+
|
|
1
22
|
# [@projectcaluma/ember-testing-v11.0.0-beta.1](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v10.2.0-beta.2...@projectcaluma/ember-testing-v11.0.0-beta.1) (2022-02-03)
|
|
2
23
|
|
|
3
24
|
|
|
@@ -5,6 +5,10 @@ export default class extends BaseFilter {
|
|
|
5
5
|
return records.filter(({ isArchived }) => isArchived === value);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
+
isPublished(records, value) {
|
|
9
|
+
return records.filter(({ isPublished }) => isPublished === value);
|
|
10
|
+
}
|
|
11
|
+
|
|
8
12
|
search(records, value) {
|
|
9
13
|
const re = new RegExp(`.*${value}.*`, "i");
|
|
10
14
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
2
|
|
|
3
3
|
import { register } from "@projectcaluma/ember-testing/mirage-graphql";
|
|
4
4
|
import BaseMock from "@projectcaluma/ember-testing/mirage-graphql/mocks/base";
|
|
@@ -74,13 +74,7 @@ export default class extends BaseMock {
|
|
|
74
74
|
@register("SaveDefaultDateAnswerPayload")
|
|
75
75
|
handleSaveDateAnswer(_, { input }) {
|
|
76
76
|
const date = input.value;
|
|
77
|
-
const value = date
|
|
78
|
-
? moment({
|
|
79
|
-
day: date.getUTCDate(),
|
|
80
|
-
month: date.getUTCMonth(),
|
|
81
|
-
year: date.getUTCFullYear(),
|
|
82
|
-
}).format(moment.HTML5_FMT.DATE)
|
|
83
|
-
: null;
|
|
77
|
+
const value = date ? DateTime.fromJSDate(date).toISODate() : null;
|
|
84
78
|
|
|
85
79
|
return this._handleSaveDocumentAnswer(_, {
|
|
86
80
|
...input,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
register,
|
|
@@ -77,7 +77,7 @@ export default class extends BaseMock {
|
|
|
77
77
|
to: { id: group },
|
|
78
78
|
from: { id: workItem.addressedGroups[0] },
|
|
79
79
|
remark: "",
|
|
80
|
-
deadline:
|
|
80
|
+
deadline: DateTime.now().plus({ days: 30 }).toJSDate(),
|
|
81
81
|
},
|
|
82
82
|
{
|
|
83
83
|
createdAt: new Date(),
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { faker } from "@faker-js/faker";
|
|
2
|
-
import
|
|
2
|
+
import { DateTime } from "luxon";
|
|
3
3
|
|
|
4
4
|
export function createBlueprint(server) {
|
|
5
|
-
const inquiryForm = server.create("form", {
|
|
6
|
-
|
|
5
|
+
const inquiryForm = server.create("form", {
|
|
6
|
+
name: "Inquiry",
|
|
7
|
+
slug: "inquiry",
|
|
8
|
+
isPublished: false,
|
|
9
|
+
});
|
|
10
|
+
const inquiryAnswerForm = server.create("form", {
|
|
11
|
+
name: "Inquiry answer",
|
|
12
|
+
slug: "inquiry-answer",
|
|
13
|
+
isPublished: false,
|
|
14
|
+
});
|
|
7
15
|
|
|
8
16
|
server.create("question", {
|
|
9
17
|
slug: "inquiry-remark",
|
|
@@ -192,6 +200,7 @@ export function reviseInquiry(server, { inquiry }) {
|
|
|
192
200
|
|
|
193
201
|
export function createCase(server, { group }) {
|
|
194
202
|
const distributionCase = server.create("case", {
|
|
203
|
+
id: "4222ab21-9c89-47de-98be-d62a8ed0ebeb",
|
|
195
204
|
status: "RUNNING",
|
|
196
205
|
workflowId: "distribution",
|
|
197
206
|
});
|
|
@@ -228,30 +237,30 @@ export default function (server, groups) {
|
|
|
228
237
|
const confirm = (...args) => confirmInquiry(...args);
|
|
229
238
|
const revise = (...args) => reviseInquiry(server, ...args);
|
|
230
239
|
|
|
231
|
-
const distributionCase = createCase(server, { group:
|
|
232
|
-
|
|
233
|
-
server.create("work-item", {
|
|
234
|
-
taskId: "create-inquiry",
|
|
235
|
-
status: "READY",
|
|
236
|
-
addressedGroups: [g.id],
|
|
237
|
-
});
|
|
240
|
+
const distributionCase = createCase(server, { group: g });
|
|
238
241
|
|
|
239
242
|
// controlling
|
|
240
243
|
create({ from: g, to: g1 });
|
|
241
244
|
send({
|
|
242
|
-
inquiry: create(
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
inquiry: create(
|
|
246
|
+
{
|
|
247
|
+
from: g,
|
|
248
|
+
to: g2,
|
|
249
|
+
deadline: faker.date.past(),
|
|
250
|
+
},
|
|
251
|
+
{ id: "6bbdc36a-3174-4578-93d4-0cb84d3dab97" }
|
|
252
|
+
),
|
|
247
253
|
});
|
|
248
254
|
confirm({
|
|
249
255
|
inquiry: answer({
|
|
250
|
-
inquiry: create(
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
256
|
+
inquiry: create(
|
|
257
|
+
{
|
|
258
|
+
from: g,
|
|
259
|
+
to: g3,
|
|
260
|
+
deadline: faker.date.past(),
|
|
261
|
+
},
|
|
262
|
+
{ id: "88999388-daf2-4a18-b7e2-50373d082331" }
|
|
263
|
+
),
|
|
255
264
|
status: "inquiry-answer-status-needs-interaction",
|
|
256
265
|
}),
|
|
257
266
|
});
|
|
@@ -259,7 +268,13 @@ export default function (server, groups) {
|
|
|
259
268
|
// "override" third controlling inquiry
|
|
260
269
|
confirm({
|
|
261
270
|
inquiry: answer({
|
|
262
|
-
inquiry: create(
|
|
271
|
+
inquiry: create(
|
|
272
|
+
{ from: g, to: g3 },
|
|
273
|
+
{
|
|
274
|
+
id: "75d56729-5518-469d-ae66-188a5c32d59d",
|
|
275
|
+
createdAt: faker.date.recent(),
|
|
276
|
+
}
|
|
277
|
+
),
|
|
263
278
|
status: "inquiry-answer-status-positive",
|
|
264
279
|
}),
|
|
265
280
|
});
|
|
@@ -267,7 +282,10 @@ export default function (server, groups) {
|
|
|
267
282
|
// addressed
|
|
268
283
|
confirm({
|
|
269
284
|
inquiry: answer({
|
|
270
|
-
inquiry: create(
|
|
285
|
+
inquiry: create(
|
|
286
|
+
{ from: g2, to: g },
|
|
287
|
+
{ id: "e907584c-a38a-488e-80f7-bab6bb22f303" }
|
|
288
|
+
),
|
|
271
289
|
status: "inquiry-answer-status-needs-interaction",
|
|
272
290
|
}),
|
|
273
291
|
});
|
|
@@ -277,24 +295,36 @@ export default function (server, groups) {
|
|
|
277
295
|
{
|
|
278
296
|
from: g2,
|
|
279
297
|
to: g,
|
|
280
|
-
deadline:
|
|
298
|
+
deadline: DateTime.now().plus({ days: 2 }).toJSDate(),
|
|
281
299
|
},
|
|
282
|
-
{
|
|
300
|
+
{
|
|
301
|
+
id: "4889435d-f310-472f-808b-7b20936c40fc",
|
|
302
|
+
createdAt: faker.date.recent(),
|
|
303
|
+
}
|
|
283
304
|
),
|
|
284
305
|
});
|
|
285
306
|
confirm({
|
|
286
307
|
inquiry: answer({
|
|
287
|
-
inquiry: create(
|
|
308
|
+
inquiry: create(
|
|
309
|
+
{ from: g4, to: g },
|
|
310
|
+
{ id: "4c5dbcc3-f42a-4c25-8d06-f85bd17edbf2" }
|
|
311
|
+
),
|
|
288
312
|
status: "inquiry-answer-status-negative",
|
|
289
313
|
}),
|
|
290
314
|
});
|
|
291
315
|
answer({
|
|
292
|
-
inquiry: create(
|
|
316
|
+
inquiry: create(
|
|
317
|
+
{ from: g3, to: g },
|
|
318
|
+
{ id: "3f7eea45-251d-4934-81fd-27c78bbca88c" }
|
|
319
|
+
),
|
|
293
320
|
status: "inquiry-answer-status-positive",
|
|
294
321
|
});
|
|
295
322
|
revise({
|
|
296
323
|
inquiry: answer({
|
|
297
|
-
inquiry: create(
|
|
324
|
+
inquiry: create(
|
|
325
|
+
{ from: g1, to: g },
|
|
326
|
+
{ id: "dd07b1a4-91e6-4411-a4ea-445637690577" }
|
|
327
|
+
),
|
|
298
328
|
status: "inquiry-answer-status-needs-interaction",
|
|
299
329
|
}),
|
|
300
330
|
});
|
|
@@ -302,13 +332,19 @@ export default function (server, groups) {
|
|
|
302
332
|
// more
|
|
303
333
|
confirm({
|
|
304
334
|
inquiry: answer({
|
|
305
|
-
inquiry: create(
|
|
335
|
+
inquiry: create(
|
|
336
|
+
{ from: g2, to: g3 },
|
|
337
|
+
{ id: "4f374860-28b3-465b-be5f-5e501a39fe8b" }
|
|
338
|
+
),
|
|
306
339
|
status: "inquiry-answer-status-needs-interaction",
|
|
307
340
|
}),
|
|
308
341
|
});
|
|
309
342
|
confirm({
|
|
310
343
|
inquiry: answer({
|
|
311
|
-
inquiry: create(
|
|
344
|
+
inquiry: create(
|
|
345
|
+
{ from: g3, to: g4 },
|
|
346
|
+
{ id: "16eebfae-55c5-4d31-ad48-7ed5578a22a2" }
|
|
347
|
+
),
|
|
312
348
|
status: "inquiry-answer-status-positive",
|
|
313
349
|
}),
|
|
314
350
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { faker } from "@faker-js/faker";
|
|
2
|
+
import { DateTime } from "luxon";
|
|
2
3
|
import { Factory } from "miragejs";
|
|
3
|
-
import moment from "moment";
|
|
4
4
|
|
|
5
5
|
export default Factory.extend({
|
|
6
6
|
id: () => faker.datatype.uuid(),
|
|
@@ -73,13 +73,7 @@ export default Factory.extend({
|
|
|
73
73
|
|
|
74
74
|
if (answer.value === undefined) {
|
|
75
75
|
const date = faker.date.future();
|
|
76
|
-
answer.update({
|
|
77
|
-
value: moment({
|
|
78
|
-
day: date.getUTCDate(),
|
|
79
|
-
month: date.getUTCMonth(),
|
|
80
|
-
year: date.getUTCFullYear(),
|
|
81
|
-
}).format(moment.HTML5_FMT.DATE),
|
|
82
|
-
});
|
|
76
|
+
answer.update({ value: DateTime.fromJSDate(date).toISODate() });
|
|
83
77
|
}
|
|
84
78
|
} else if (answer.question.type === "TABLE") {
|
|
85
79
|
answer.update({ type: "TABLE" });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@projectcaluma/ember-testing",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.4",
|
|
4
4
|
"description": "Ember addon for testing with Caluma addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -14,26 +14,26 @@
|
|
|
14
14
|
"test:ember-compatibility": "ember try:each"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@faker-js/faker": "^6.0.0-
|
|
17
|
+
"@faker-js/faker": "^6.0.0-beta.0",
|
|
18
18
|
"broccoli-funnel": "^3.0.8",
|
|
19
19
|
"broccoli-merge-trees": "^4.2.0",
|
|
20
20
|
"ember-apollo-client": "^3.2.0",
|
|
21
21
|
"ember-auto-import": "^2.4.0",
|
|
22
22
|
"ember-cli-babel": "^7.26.11",
|
|
23
23
|
"ember-cli-htmlbars": "^6.0.1",
|
|
24
|
-
"ember-cli-mirage": "^
|
|
24
|
+
"ember-cli-mirage": "^3.0.0-alpha.2",
|
|
25
25
|
"ember-fetch": "^8.1.1",
|
|
26
26
|
"ember-inflector": "^4.0.2",
|
|
27
27
|
"graphql": "^15.8.0",
|
|
28
28
|
"graphql-iso-date": "^3.6.1",
|
|
29
29
|
"graphql-tools": "^4.0.8",
|
|
30
|
-
"
|
|
31
|
-
"
|
|
30
|
+
"luxon": "^2.3.1",
|
|
31
|
+
"miragejs": "^0.1.43"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@ember/optional-features": "2.0.0",
|
|
35
35
|
"@ember/test-helpers": "2.6.0",
|
|
36
|
-
"@embroider/test-setup": "1.
|
|
36
|
+
"@embroider/test-setup": "1.5.0",
|
|
37
37
|
"broccoli-asset-rev": "3.0.0",
|
|
38
38
|
"ember-cli": "3.28.5",
|
|
39
39
|
"ember-cli-code-coverage": "1.0.3",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"ember-try": "2.0.0",
|
|
53
53
|
"graphql-tag": "2.12.6",
|
|
54
54
|
"loader.js": "4.7.0",
|
|
55
|
-
"qunit": "2.
|
|
55
|
+
"qunit": "2.18.0",
|
|
56
56
|
"qunit-dom": "2.0.0",
|
|
57
|
-
"webpack": "5.
|
|
57
|
+
"webpack": "5.70.0"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": "12.* || 14.* || >= 16"
|