@projectcaluma/ember-testing 10.2.0-beta.1 → 10.2.0-beta.2

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,6 +1,6 @@
1
1
  import { camelize, dasherize, classify } from "@ember/string";
2
+ import faker from "@faker-js/faker";
2
3
  import { singularize, pluralize } from "ember-inflector";
3
- import faker from "faker";
4
4
  import { MockList } from "graphql-tools";
5
5
 
6
6
  import {
@@ -1,8 +1,11 @@
1
+ import moment from "moment";
2
+
1
3
  import {
2
4
  register,
3
5
  deserialize,
4
6
  } from "@projectcaluma/ember-testing/mirage-graphql";
5
7
  import BaseMock from "@projectcaluma/ember-testing/mirage-graphql/mocks/base";
8
+ import { createInquiry } from "@projectcaluma/ember-testing/scenarios/distribution";
6
9
 
7
10
  export default class extends BaseMock {
8
11
  @register("ResumeWorkItemPayload")
@@ -63,6 +66,36 @@ export default class extends BaseMock {
63
66
  status: "READY",
64
67
  taskId: "adjust-inquiry-answer",
65
68
  });
69
+ } else if (taskId === "create-inquiry") {
70
+ const { addressed_groups: groups } = JSON.parse(input.context);
71
+
72
+ groups.forEach((group) => {
73
+ createInquiry(
74
+ this.server,
75
+ workItem.case,
76
+ {
77
+ to: { id: group },
78
+ from: { id: workItem.addressedGroups[0] },
79
+ remark: "",
80
+ deadline: moment().add(30, "days").toDate(),
81
+ },
82
+ {
83
+ createdAt: new Date(),
84
+ }
85
+ );
86
+
87
+ this.server.create("work-item", {
88
+ taskId: "create-inquiry",
89
+ status: "READY",
90
+ addressedGroups: [group],
91
+ });
92
+ });
93
+
94
+ this.server.create("work-item", {
95
+ taskId: "create-inquiry",
96
+ status: "READY",
97
+ addressedGroups: workItem.addressedGroups,
98
+ });
66
99
  }
67
100
 
68
101
  return this.handleSavePayload.fn.call(this, _, {
@@ -1,4 +1,4 @@
1
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
2
  import moment from "moment";
3
3
 
4
4
  export function createBlueprint(server) {
@@ -56,6 +56,8 @@ export function createBlueprint(server) {
56
56
  server.create("workflow", { slug: "distribution" });
57
57
  server.create("workflow", { slug: "inquiry" });
58
58
 
59
+ server.create("task", { slug: "create-inquiry" });
60
+ server.create("task", { slug: "complete-distribution" });
59
61
  server.create("task", { slug: "inquiry" });
60
62
  server.create("task", {
61
63
  slug: "compose-inquiry-answer",
@@ -188,14 +190,32 @@ export function reviseInquiry(server, { inquiry }) {
188
190
  return inquiry;
189
191
  }
190
192
 
191
- export default function (server, groups) {
192
- createBlueprint(server);
193
-
193
+ export function createCase(server, { group }) {
194
194
  const distributionCase = server.create("case", {
195
195
  status: "RUNNING",
196
196
  workflowId: "distribution",
197
197
  });
198
198
 
199
+ server.create("work-item", {
200
+ case: distributionCase,
201
+ taskId: "create-inquiry",
202
+ status: "READY",
203
+ addressedGroups: [group.id],
204
+ });
205
+
206
+ server.create("work-item", {
207
+ case: distributionCase,
208
+ taskId: "complete-distribution",
209
+ status: "READY",
210
+ addressedGroups: [group.id],
211
+ });
212
+
213
+ return distributionCase;
214
+ }
215
+
216
+ export default function (server, groups) {
217
+ createBlueprint(server);
218
+
199
219
  const g = groups[0];
200
220
  const g1 = groups[1];
201
221
  const g2 = groups[2];
@@ -208,6 +228,14 @@ export default function (server, groups) {
208
228
  const confirm = (...args) => confirmInquiry(...args);
209
229
  const revise = (...args) => reviseInquiry(server, ...args);
210
230
 
231
+ const distributionCase = createCase(server, { group: g1 });
232
+
233
+ server.create("work-item", {
234
+ taskId: "create-inquiry",
235
+ status: "READY",
236
+ addressedGroups: [g.id],
237
+ });
238
+
211
239
  // controlling
212
240
  create({ from: g, to: g1 });
213
241
  send({
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
  import moment from "moment";
4
4
 
5
5
  export default Factory.extend({
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  const STATUS = ["RUNNING", "COMPLETED", "CANCELED", "SUSPENDED"];
5
5
 
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id: () => faker.datatype.uuid(),
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id: () => faker.datatype.uuid(),
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id() {
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id() {
@@ -1,4 +1,4 @@
1
- import { Factory } from "ember-cli-mirage";
1
+ import { Factory } from "miragejs";
2
2
 
3
3
  export default Factory.extend({
4
4
  id() {
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id() {
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  export default Factory.extend({
5
5
  id() {
@@ -1,5 +1,5 @@
1
- import { Factory } from "ember-cli-mirage";
2
- import faker from "faker";
1
+ import faker from "@faker-js/faker";
2
+ import { Factory } from "miragejs";
3
3
 
4
4
  const STATUS = ["READY", "CANCELED", "COMPLETED", "SKIPPED", "SUSPENDED"];
5
5
 
@@ -1,4 +1,4 @@
1
- import { Factory } from "ember-cli-mirage";
1
+ import { Factory } from "miragejs";
2
2
 
3
3
  export default Factory.extend({
4
4
  id() {
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo, hasMany } from "ember-cli-mirage";
1
+ import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  document: belongsTo("document"),
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo, hasMany } from "ember-cli-mirage";
1
+ import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  document: belongsTo(),
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo, hasMany } from "ember-cli-mirage";
1
+ import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  form: belongsTo(),
@@ -1,3 +1,3 @@
1
- import { Model } from "ember-cli-mirage";
1
+ import { Model } from "miragejs";
2
2
 
3
3
  export default Model.extend({});
@@ -1,4 +1,4 @@
1
- import { Model, hasMany } from "ember-cli-mirage";
1
+ import { Model, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  questions: hasMany({ inverse: "forms" }),
@@ -1,3 +1,3 @@
1
- import { Model } from "ember-cli-mirage";
1
+ import { Model } from "miragejs";
2
2
 
3
3
  export default Model.extend({});
@@ -1,4 +1,4 @@
1
- import { Model, hasMany } from "ember-cli-mirage";
1
+ import { Model, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  questions: hasMany(),
@@ -1,4 +1,4 @@
1
- import { Model, hasMany, belongsTo } from "ember-cli-mirage";
1
+ import { Model, hasMany, belongsTo } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  forms: hasMany({ inverse: "questions" }),
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo, hasMany } from "ember-cli-mirage";
1
+ import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  workflow: belongsTo(),
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo } from "ember-cli-mirage";
1
+ import { Model, belongsTo } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  case: belongsTo(),
@@ -1,4 +1,4 @@
1
- import { Model, belongsTo, hasMany } from "ember-cli-mirage";
1
+ import { Model, belongsTo, hasMany } from "miragejs";
2
2
 
3
3
  export default Model.extend({
4
4
  workflow: belongsTo(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@projectcaluma/ember-testing",
3
- "version": "10.2.0-beta.1",
3
+ "version": "10.2.0-beta.2",
4
4
  "description": "Ember addon for testing with Caluma addons.",
5
5
  "keywords": [
6
6
  "ember-addon"
@@ -14,25 +14,26 @@
14
14
  "test:ember-compatibility": "ember try:each"
15
15
  },
16
16
  "dependencies": {
17
+ "@faker-js/faker": "^6.0.0-alpha.3",
17
18
  "broccoli-funnel": "^3.0.8",
18
19
  "broccoli-merge-trees": "^4.2.0",
19
20
  "ember-apollo-client": "^3.2.0",
20
- "ember-auto-import": "^2.2.3",
21
+ "ember-auto-import": "^2.3.0",
21
22
  "ember-cli-babel": "^7.26.11",
22
23
  "ember-cli-htmlbars": "^6.0.1",
23
- "ember-cli-mirage": "^2.2.0",
24
- "ember-fetch": "^8.0.4",
24
+ "ember-cli-mirage": "^2.3.1",
25
+ "ember-fetch": "^8.1.1",
25
26
  "ember-inflector": "^4.0.2",
26
- "faker": "^5.5.3",
27
27
  "graphql": "^15.8.0",
28
28
  "graphql-iso-date": "^3.6.1",
29
29
  "graphql-tools": "^4.0.8",
30
+ "miragejs": "^0.1.43",
30
31
  "moment": "^2.29.1"
31
32
  },
32
33
  "devDependencies": {
33
34
  "@ember/optional-features": "2.0.0",
34
35
  "@ember/test-helpers": "2.6.0",
35
- "@embroider/test-setup": "0.49.0",
36
+ "@embroider/test-setup": "0.50.2",
36
37
  "broccoli-asset-rev": "3.0.0",
37
38
  "ember-cli": "3.28.5",
38
39
  "ember-cli-code-coverage": "1.0.3",
@@ -54,7 +55,7 @@
54
55
  "loader.js": "4.7.0",
55
56
  "qunit": "2.17.2",
56
57
  "qunit-dom": "2.0.0",
57
- "webpack": "5.65.0"
58
+ "webpack": "5.66.0"
58
59
  },
59
60
  "engines": {
60
61
  "node": "12.* || 14.* || >= 16"