@projectcaluma/ember-testing 11.0.0-beta.29 → 11.0.0-beta.30

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.
@@ -1,5 +1,3 @@
1
- import { DateTime } from "luxon";
2
-
3
1
  import deserialize from "@projectcaluma/ember-testing/mirage-graphql/deserialize";
4
2
  import BaseMock from "@projectcaluma/ember-testing/mirage-graphql/mocks/base";
5
3
  import register from "@projectcaluma/ember-testing/mirage-graphql/register";
@@ -98,7 +96,7 @@ export default class WorkItemMock extends BaseMock {
98
96
  taskId: "adjust-inquiry-answer",
99
97
  });
100
98
  } else if (taskId === "create-inquiry") {
101
- const { addressed_groups: groups } = JSON.parse(input.context);
99
+ const { addressed_groups: groups, answers } = JSON.parse(input.context);
102
100
 
103
101
  groups.forEach((group) => {
104
102
  createInquiry(
@@ -107,8 +105,8 @@ export default class WorkItemMock extends BaseMock {
107
105
  {
108
106
  to: { id: group },
109
107
  from: { id: workItem.addressedGroups[0] },
110
- remark: "",
111
- deadline: DateTime.now().plus({ days: 30 }).toJSDate(),
108
+ remark: answers["inquiry-remark"],
109
+ deadline: answers["inquiry-deadline"],
112
110
  },
113
111
  {
114
112
  createdAt: new Date(),
@@ -76,7 +76,11 @@ export function createBlueprint(server) {
76
76
  server.create("task", { slug: "distribution" });
77
77
  server.create("task", { slug: "create-inquiry" });
78
78
  server.create("task", { slug: "complete-distribution" });
79
- server.create("task", { slug: "inquiry" });
79
+ server.create("task", {
80
+ slug: "inquiry",
81
+ formId: inquiryForm.id,
82
+ type: "COMPLETE_TASK_FORM",
83
+ });
80
84
  server.create("task", {
81
85
  slug: "compose-inquiry-answer",
82
86
  type: "COMPLETE_WORKFLOW_FORM",
@@ -87,6 +91,7 @@ export function createBlueprint(server) {
87
91
  slug: "adjust-inquiry-answer",
88
92
  type: "COMPLETE_WORKFLOW_FORM",
89
93
  });
94
+ server.create("task", { slug: "check-inquiries" });
90
95
  }
91
96
 
92
97
  export function createInquiry(
@@ -192,7 +197,7 @@ export function answerInquiry(server, { inquiry, status, reason, hint }) {
192
197
  return inquiry;
193
198
  }
194
199
 
195
- export function confirmInquiry({ inquiry }) {
200
+ export function confirmInquiry(server, { inquiry }) {
196
201
  inquiry.update({ status: "COMPLETED", isRedoable: true });
197
202
  inquiry.childCase.update({
198
203
  status: "COMPLETED",
@@ -205,6 +210,21 @@ export function confirmInquiry({ inquiry }) {
205
210
  .filter((workItem) => workItem.taskId === "revise-inquiry-answer")
206
211
  .update({ status: "CANCELED" });
207
212
 
213
+ if (
214
+ !inquiry.case.workItems.filter(
215
+ (workItem) =>
216
+ workItem.taskId === "check-inquiries" &&
217
+ String(workItem.addressedGroups) === String(inquiry.addressedGroups)
218
+ ).length
219
+ ) {
220
+ server.create("work-item", {
221
+ taskId: "check-inquiries",
222
+ status: "READY",
223
+ case: inquiry.case,
224
+ addressedGroups: inquiry.addressedGroups,
225
+ });
226
+ }
227
+
208
228
  return inquiry;
209
229
  }
210
230
 
@@ -269,7 +289,7 @@ export default function (server, groups) {
269
289
  const withdraw = (...args) => withdrawInquiry(server, ...args);
270
290
  const send = (...args) => sendInquiry(server, ...args);
271
291
  const answer = (...args) => answerInquiry(server, ...args);
272
- const confirm = (...args) => confirmInquiry(...args);
292
+ const confirm = (...args) => confirmInquiry(server, ...args);
273
293
  const revise = (...args) => reviseInquiry(server, ...args);
274
294
 
275
295
  const distributionCase = createCase(server, { group: g });
@@ -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.29",
3
+ "version": "11.0.0-beta.30",
4
4
  "description": "Ember addon for testing with Caluma addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -15,11 +15,11 @@
15
15
  },
16
16
  "dependencies": {
17
17
  "@ember/string": "^3.0.0",
18
- "@faker-js/faker": "^7.5.0",
18
+ "@faker-js/faker": "^7.6.0",
19
19
  "broccoli-funnel": "^3.0.8",
20
20
  "broccoli-merge-trees": "^4.2.0",
21
21
  "ember-apollo-client": "~4.0.2",
22
- "ember-auto-import": "^2.4.2",
22
+ "ember-auto-import": "^2.4.3",
23
23
  "ember-cli-babel": "^7.26.11",
24
24
  "ember-cli-htmlbars": "^6.1.1",
25
25
  "ember-cli-mirage": "^3.0.0-alpha.3",
@@ -28,7 +28,7 @@
28
28
  "graphql": "^15.8.0",
29
29
  "graphql-iso-date": "^3.6.1",
30
30
  "graphql-tools": "^4.0.8",
31
- "luxon": "^3.0.3",
31
+ "luxon": "^3.0.4",
32
32
  "miragejs": "^0.1.45"
33
33
  },
34
34
  "devDependencies": {
@@ -44,14 +44,14 @@
44
44
  "ember-cli-terser": "4.0.2",
45
45
  "ember-disable-prototype-extensions": "1.1.3",
46
46
  "ember-load-initializers": "2.1.2",
47
- "ember-qunit": "5.1.5",
47
+ "ember-qunit": "6.0.0",
48
48
  "ember-resolver": "8.0.3",
49
- "ember-source": "4.7.0",
49
+ "ember-source": "4.8.0",
50
50
  "ember-source-channel-url": "3.0.0",
51
51
  "ember-try": "2.0.0",
52
52
  "graphql-tag": "2.12.6",
53
53
  "loader.js": "4.7.0",
54
- "qunit": "2.19.1",
54
+ "qunit": "2.19.2",
55
55
  "qunit-dom": "2.0.0",
56
56
  "webpack": "5.74.0"
57
57
  },