@projectcaluma/ember-testing 11.0.0-beta.9 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -73,9 +73,14 @@ export function createBlueprint(server) {
73
73
  server.create("workflow", { slug: "distribution" });
74
74
  server.create("workflow", { slug: "inquiry" });
75
75
 
76
+ server.create("task", { slug: "distribution" });
76
77
  server.create("task", { slug: "create-inquiry" });
77
78
  server.create("task", { slug: "complete-distribution" });
78
- server.create("task", { slug: "inquiry" });
79
+ server.create("task", {
80
+ slug: "inquiry",
81
+ formId: inquiryForm.id,
82
+ type: "COMPLETE_TASK_FORM",
83
+ });
79
84
  server.create("task", {
80
85
  slug: "compose-inquiry-answer",
81
86
  type: "COMPLETE_WORKFLOW_FORM",
@@ -86,6 +91,7 @@ export function createBlueprint(server) {
86
91
  slug: "adjust-inquiry-answer",
87
92
  type: "COMPLETE_WORKFLOW_FORM",
88
93
  });
94
+ server.create("task", { slug: "check-inquiries" });
89
95
  }
90
96
 
91
97
  export function createInquiry(
@@ -94,10 +100,7 @@ export function createInquiry(
94
100
  { from, to, remark, deadline },
95
101
  workItemAttrs = {}
96
102
  ) {
97
- const document = server.create("document", {
98
- formId: "inquiry",
99
- modifiedContentByUser: "1",
100
- });
103
+ const document = server.create("document", { formId: "inquiry" });
101
104
 
102
105
  server.create("answer", {
103
106
  document,
@@ -134,7 +137,7 @@ export function sendInquiry(server, { inquiry }) {
134
137
  workflowId: "inquiry",
135
138
  document: server.create("document", {
136
139
  formId: "inquiry-answer",
137
- modifiedContentByUser: "1",
140
+ modifiedContentAt: faker.date.recent(),
138
141
  }),
139
142
  });
140
143
 
@@ -191,8 +194,8 @@ export function answerInquiry(server, { inquiry, status, reason, hint }) {
191
194
  return inquiry;
192
195
  }
193
196
 
194
- export function confirmInquiry({ inquiry }) {
195
- inquiry.update({ status: "COMPLETED" });
197
+ export function confirmInquiry(server, { inquiry }) {
198
+ inquiry.update({ status: "COMPLETED", isRedoable: true });
196
199
  inquiry.childCase.update({
197
200
  status: "COMPLETED",
198
201
  closedAt: faker.date.recent(),
@@ -204,6 +207,21 @@ export function confirmInquiry({ inquiry }) {
204
207
  .filter((workItem) => workItem.taskId === "revise-inquiry-answer")
205
208
  .update({ status: "CANCELED" });
206
209
 
210
+ if (
211
+ !inquiry.case.workItems.filter(
212
+ (workItem) =>
213
+ workItem.taskId === "check-inquiries" &&
214
+ String(workItem.addressedGroups) === String(inquiry.addressedGroups)
215
+ ).length
216
+ ) {
217
+ server.create("work-item", {
218
+ taskId: "check-inquiries",
219
+ status: "READY",
220
+ case: inquiry.case,
221
+ addressedGroups: inquiry.addressedGroups,
222
+ });
223
+ }
224
+
207
225
  return inquiry;
208
226
  }
209
227
 
@@ -225,10 +243,17 @@ export function reviseInquiry(server, { inquiry }) {
225
243
  }
226
244
 
227
245
  export function createCase(server, { group }) {
246
+ const distributionWorkItem = server.create("work-item", {
247
+ taskId: "distribution",
248
+ status: "READY",
249
+ case: server.create("case"),
250
+ });
251
+
228
252
  const distributionCase = server.create("case", {
229
253
  id: "4222ab21-9c89-47de-98be-d62a8ed0ebeb",
230
254
  status: "RUNNING",
231
255
  workflowId: "distribution",
256
+ parentWorkItem: distributionWorkItem,
232
257
  });
233
258
 
234
259
  server.create("work-item", {
@@ -261,7 +286,7 @@ export default function (server, groups) {
261
286
  const withdraw = (...args) => withdrawInquiry(server, ...args);
262
287
  const send = (...args) => sendInquiry(server, ...args);
263
288
  const answer = (...args) => answerInquiry(server, ...args);
264
- const confirm = (...args) => confirmInquiry(...args);
289
+ const confirm = (...args) => confirmInquiry(server, ...args);
265
290
  const revise = (...args) => reviseInquiry(server, ...args);
266
291
 
267
292
  const distributionCase = createCase(server, { group: g });
@@ -281,7 +306,7 @@ export default function (server, groups) {
281
306
  to: g2,
282
307
  deadline: faker.date.past(),
283
308
  },
284
- { id: "6bbdc36a-3174-4578-93d4-0cb84d3dab97" }
309
+ { id: "6bbdc36a-3174-4578-93d4-0cb84d3dab97", meta: {} }
285
310
  ),
286
311
  });
287
312
  confirm({
@@ -389,4 +414,6 @@ export default function (server, groups) {
389
414
  status: "inquiry-answer-status-positive",
390
415
  }),
391
416
  });
417
+
418
+ return distributionCase;
392
419
  }
@@ -58,15 +58,19 @@ export default Factory.extend({
58
58
  .slug,
59
59
  });
60
60
  }
61
- } else if (answer.question.type === "FILE") {
62
- answer.update({ type: "FILE" });
61
+ } else if (answer.question.type === "FILES") {
62
+ answer.update({ type: "FILES" });
63
63
 
64
64
  if (answer.value === undefined) {
65
65
  answer.update({
66
- value: {
67
- uploadUrl: faker.internet.url,
68
- downloadUrl: faker.internet.url,
69
- },
66
+ value: [
67
+ {
68
+ id: faker.datatype.uuid(),
69
+ name: faker.datatype.string(),
70
+ uploadUrl: faker.internet.url(),
71
+ downloadUrl: faker.internet.url(),
72
+ },
73
+ ],
70
74
  });
71
75
  }
72
76
  } else if (answer.question.type === "DATE") {
@@ -3,6 +3,4 @@ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id: () => faker.datatype.uuid(),
6
- modifiedContentByUser: () => faker.datatype.uuid(),
7
- modifiedContentAt: () => faker.date.past(),
8
6
  });
@@ -3,7 +3,7 @@ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id: () => faker.datatype.uuid(),
6
- createdAt: () => faker.date.past(),
6
+ name: () => faker.datatype.string(),
7
7
  modifiedAt: () => faker.date.past(),
8
8
  createdByUser: () => faker.datatype.uuid(),
9
9
  uploadUrl: () => faker.internet.url(),
@@ -11,4 +11,8 @@ export default Factory.extend({
11
11
  isArchived: false,
12
12
  isPublished: true,
13
13
  meta: () => ({}),
14
+ createdByUser: () => faker.random.numeric(10),
15
+ createdByGroup: () => faker.random.numeric(10),
16
+ modifiedByUser: () => faker.random.numeric(10),
17
+ modifiedByGroup: () => faker.random.numeric(10),
14
18
  });
@@ -11,9 +11,11 @@ export default Factory.extend({
11
11
  deadline: () => faker.date.future(),
12
12
  status: () => faker.helpers.arrayElement(STATUS),
13
13
  addressedGroups: () => ["group1", "group2"],
14
+ assignedUsers: () => ["1"],
14
15
  closedAt() {
15
16
  return STATUS.filter((s) => s !== "READY").includes(this.status)
16
17
  ? faker.date.past()
17
18
  : null;
18
19
  },
20
+ isRedoable: () => false,
19
21
  });
@@ -1,6 +1,7 @@
1
1
  import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
+ form: belongsTo(),
4
5
  workflow: belongsTo(),
5
6
  workItems: hasMany(),
6
7
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-testing",
3
- "version": "11.0.0-beta.9",
3
+ "version": "11.0.0",
4
4
  "description": "Ember addon for testing with Caluma addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -9,56 +9,57 @@
9
9
  "homepage": "https://docs.caluma.io/ember-caluma",
10
10
  "repository": "github:projectcaluma/ember-caluma",
11
11
  "scripts": {
12
- "test": "npm-run-all test:*",
12
+ "test": "concurrently \"npm:lint\" \"npm:test:*\" --names \"lint,test:\"",
13
13
  "test:ember": "ember test",
14
14
  "test:ember-compatibility": "ember try:each"
15
15
  },
16
16
  "dependencies": {
17
- "@ember/string": "^3.0.0",
18
- "@faker-js/faker": "^7.2.0",
17
+ "@ember/string": "^3.0.1",
18
+ "@faker-js/faker": "^7.6.0",
19
19
  "broccoli-funnel": "^3.0.8",
20
20
  "broccoli-merge-trees": "^4.2.0",
21
- "ember-apollo-client": "^4.0.2",
22
- "ember-auto-import": "^2.4.2",
21
+ "ember-apollo-client": "~4.0.2",
22
+ "ember-auto-import": "^2.6.0",
23
23
  "ember-cli-babel": "^7.26.11",
24
- "ember-cli-htmlbars": "^6.0.1",
24
+ "ember-cli-htmlbars": "^6.2.0",
25
25
  "ember-cli-mirage": "^3.0.0-alpha.3",
26
- "ember-fetch": "^8.1.1",
26
+ "ember-fetch": "^8.1.2",
27
27
  "ember-inflector": "^4.0.2",
28
28
  "graphql": "^15.8.0",
29
29
  "graphql-iso-date": "^3.6.1",
30
30
  "graphql-tools": "^4.0.8",
31
- "luxon": "^2.4.0",
32
- "miragejs": "^0.1.45"
31
+ "luxon": "^3.2.1",
32
+ "miragejs": "^0.1.47"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@ember/optional-features": "2.0.0",
36
- "@ember/test-helpers": "2.8.1",
37
- "@embroider/test-setup": "1.7.1",
36
+ "@ember/test-helpers": "2.7.0",
37
+ "@embroider/test-setup": "2.1.1",
38
38
  "broccoli-asset-rev": "3.0.0",
39
- "ember-cli": "3.28.5",
40
- "ember-cli-code-coverage": "1.0.3",
39
+ "concurrently": "7.6.0",
40
+ "ember-cli": "4.9.2",
41
+ "ember-cli-code-coverage": "2.0.0",
41
42
  "ember-cli-dependency-checker": "3.3.1",
42
43
  "ember-cli-inject-live-reload": "2.1.0",
43
44
  "ember-cli-sri": "2.1.1",
44
45
  "ember-cli-terser": "4.0.2",
45
- "ember-disable-prototype-extensions": "1.1.3",
46
- "ember-export-application-global": "2.0.1",
47
46
  "ember-load-initializers": "2.1.2",
48
- "ember-maybe-import-regenerator": "1.0.0",
49
- "ember-qunit": "5.1.5",
50
- "ember-resolver": "8.0.3",
51
- "ember-source": "3.28.9",
47
+ "ember-qunit": "6.1.1",
48
+ "ember-resolver": "8.1.0",
49
+ "ember-source": "4.10.0",
52
50
  "ember-source-channel-url": "3.0.0",
53
51
  "ember-try": "2.0.0",
54
52
  "graphql-tag": "2.12.6",
55
53
  "loader.js": "4.7.0",
56
- "qunit": "2.19.1",
54
+ "qunit": "2.19.4",
57
55
  "qunit-dom": "2.0.0",
58
- "webpack": "5.73.0"
56
+ "webpack": "5.75.0"
57
+ },
58
+ "peerDependencies": {
59
+ "ember-source": "^3.28.0 || ^4.0.0"
59
60
  },
60
61
  "engines": {
61
- "node": "12.* || 14.* || >= 16"
62
+ "node": "14.* || 16.* || >= 18"
62
63
  },
63
64
  "ember": {
64
65
  "edition": "octane"
@@ -1,5 +0,0 @@
1
- "use strict";
2
-
3
- module.exports = function (/* environment, appConfig */) {
4
- return {};
5
- };