@projectcaluma/ember-testing 11.0.0-beta.10 → 11.0.0-beta.24
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/addon/mirage-graphql/filters/answer.js +4 -6
- package/addon/mirage-graphql/filters/base.js +22 -1
- package/addon/mirage-graphql/filters/work-item.js +10 -10
- package/addon/mirage-graphql/mocks/work-item.js +26 -1
- package/addon/mirage-graphql/schema.graphql +29 -39
- package/addon/scenarios/distribution.js +10 -0
- package/addon-mirage-support/factories/form.js +4 -0
- package/addon-mirage-support/factories/work-item.js +1 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
# [@projectcaluma/ember-testing-v11.0.0-beta.11](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v11.0.0-beta.10...@projectcaluma/ember-testing-v11.0.0-beta.11) (2022-08-15)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **testing:** add createdBy and modifiedBy filters ([c6ace21](https://github.com/projectcaluma/ember-caluma/commit/c6ace21c573d45da6f99c0bc2de076c507f4f056))
|
|
7
|
+
* **testing:** allow inverting of filters ([88ab05d](https://github.com/projectcaluma/ember-caluma/commit/88ab05d4c01275e835d79c22451592666cec4db2))
|
|
8
|
+
|
|
1
9
|
# [@projectcaluma/ember-testing-v11.0.0-beta.10](https://github.com/projectcaluma/ember-caluma/compare/@projectcaluma/ember-testing-v11.0.0-beta.9...@projectcaluma/ember-testing-v11.0.0-beta.10) (2022-08-05)
|
|
2
10
|
|
|
3
11
|
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import BaseFilter from "@projectcaluma/ember-testing/mirage-graphql/filters/base";
|
|
2
2
|
|
|
3
3
|
export default class AnswerFilter extends BaseFilter {
|
|
4
|
-
questions(records, value
|
|
5
|
-
return records.filter(
|
|
6
|
-
(record) => invert !== value.includes(record.questionId)
|
|
7
|
-
);
|
|
4
|
+
questions(records, value) {
|
|
5
|
+
return records.filter((record) => value.includes(record.questionId));
|
|
8
6
|
}
|
|
9
7
|
|
|
10
|
-
question(records, value
|
|
11
|
-
return this.questions(records, [value]
|
|
8
|
+
question(records, value) {
|
|
9
|
+
return this.questions(records, [value]);
|
|
12
10
|
}
|
|
13
11
|
}
|
|
@@ -23,7 +23,12 @@ export default class BaseFilter {
|
|
|
23
23
|
const fn = this[key];
|
|
24
24
|
|
|
25
25
|
return typeof fn === "function" && ![null, undefined].includes(value)
|
|
26
|
-
? (records) =>
|
|
26
|
+
? (records) => {
|
|
27
|
+
const filteredRecords = fn.call(this, records, value, options);
|
|
28
|
+
return options?.invert
|
|
29
|
+
? records.filter((record) => !filteredRecords.includes(record))
|
|
30
|
+
: filteredRecords;
|
|
31
|
+
}
|
|
27
32
|
: (records) => records;
|
|
28
33
|
});
|
|
29
34
|
}
|
|
@@ -64,6 +69,22 @@ export default class BaseFilter {
|
|
|
64
69
|
return records.filter(({ slug }) => values.includes(slug));
|
|
65
70
|
}
|
|
66
71
|
|
|
72
|
+
createdByUser(records, value) {
|
|
73
|
+
return records.filter(({ createdByUser }) => createdByUser === value);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
createdByGroup(records, value) {
|
|
77
|
+
return records.filter(({ createdByGroup }) => createdByGroup === value);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
modifiedByUser(records, value) {
|
|
81
|
+
return records.filter(({ modifiedByUser }) => modifiedByUser === value);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
modifiedByGroup(records, value) {
|
|
85
|
+
return records.filter(({ modifiedByGroup }) => modifiedByGroup === value);
|
|
86
|
+
}
|
|
87
|
+
|
|
67
88
|
id(records, value) {
|
|
68
89
|
if (value === undefined || value === null) {
|
|
69
90
|
return [];
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
import BaseFilter from "@projectcaluma/ember-testing/mirage-graphql/filters/base";
|
|
2
2
|
|
|
3
3
|
export default class WorkItemFilter extends BaseFilter {
|
|
4
|
-
status(records, value
|
|
5
|
-
return records.filter(({ status }) =>
|
|
4
|
+
status(records, value) {
|
|
5
|
+
return records.filter(({ status }) => status === value);
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
tasks(records, value
|
|
9
|
-
return records.filter((record) =>
|
|
8
|
+
tasks(records, value) {
|
|
9
|
+
return records.filter((record) => value.includes(record.taskId));
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
task(records, value
|
|
13
|
-
return this.tasks(records, [value]
|
|
12
|
+
task(records, value) {
|
|
13
|
+
return this.tasks(records, [value]);
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
controllingGroups(records, value
|
|
16
|
+
controllingGroups(records, value) {
|
|
17
17
|
return records.filter((record) =>
|
|
18
|
-
value.every((g) =>
|
|
18
|
+
value.every((g) => record.controllingGroups?.includes(g))
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
-
addressedGroups(records, value
|
|
22
|
+
addressedGroups(records, value) {
|
|
23
23
|
return records.filter((record) =>
|
|
24
|
-
value.every((g) =>
|
|
24
|
+
value.every((g) => record.addressedGroups?.includes(g))
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -27,6 +27,27 @@ export default class WorkItemMock extends BaseMock {
|
|
|
27
27
|
});
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
@register("RedoWorkItemPayload")
|
|
31
|
+
handleRedoWorkItem(_, { input }) {
|
|
32
|
+
const { id } = deserialize(input);
|
|
33
|
+
const workItem = this.collection.find(id);
|
|
34
|
+
|
|
35
|
+
if (workItem.taskId === "distribution") {
|
|
36
|
+
const caseId = workItem.childCaseId;
|
|
37
|
+
|
|
38
|
+
this.collection
|
|
39
|
+
.where({ caseId, taskId: "complete-distribution" })
|
|
40
|
+
.update({ status: "READY" });
|
|
41
|
+
this.collection
|
|
42
|
+
.where({ caseId, taskId: "create-inquiry" })
|
|
43
|
+
.update({ status: "READY" });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return this.handleSavePayload.fn.call(this, _, {
|
|
47
|
+
input: { id, isRedoable: false, status: "READY" },
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
30
51
|
@register("CompleteWorkItemPayload")
|
|
31
52
|
handleCompleteWorkItem(_, { input }) {
|
|
32
53
|
const { id } = deserialize(input);
|
|
@@ -102,6 +123,10 @@ export default class WorkItemMock extends BaseMock {
|
|
|
102
123
|
addressedGroups: workItem.addressedGroups,
|
|
103
124
|
});
|
|
104
125
|
} else if (taskId === "complete-distribution") {
|
|
126
|
+
this.collection
|
|
127
|
+
.where({ childCaseId: caseId, status: "READY", taskId: "distribution" })
|
|
128
|
+
.update({ status: "COMPLETED", isRedoable: true });
|
|
129
|
+
|
|
105
130
|
this.collection
|
|
106
131
|
.where({ caseId, status: "READY", taskId: "inquiry" })
|
|
107
132
|
.update({ status: "SKIPPED" });
|
|
@@ -116,7 +141,7 @@ export default class WorkItemMock extends BaseMock {
|
|
|
116
141
|
}
|
|
117
142
|
|
|
118
143
|
return this.handleSavePayload.fn.call(this, _, {
|
|
119
|
-
input: { id
|
|
144
|
+
input: { id, status: "COMPLETED" },
|
|
120
145
|
});
|
|
121
146
|
}
|
|
122
147
|
}
|
|
@@ -619,6 +619,7 @@ input CaseFilterSetType {
|
|
|
619
619
|
metaHasKey: String
|
|
620
620
|
metaValue: [JSONValueFilterType]
|
|
621
621
|
id: ID
|
|
622
|
+
ids: [ID]
|
|
622
623
|
documentForm: String
|
|
623
624
|
documentForms: [String]
|
|
624
625
|
hasAnswer: [HasAnswerFilterType]
|
|
@@ -1409,7 +1410,6 @@ type FilesAnswer implements Answer & Node {
|
|
|
1409
1410
|
question: Question!
|
|
1410
1411
|
value: [File]!
|
|
1411
1412
|
meta: GenericScalar!
|
|
1412
|
-
file: File
|
|
1413
1413
|
}
|
|
1414
1414
|
|
|
1415
1415
|
type FilesQuestion implements Question & Node {
|
|
@@ -1950,8 +1950,6 @@ type Mutation {
|
|
|
1950
1950
|
saveCompleteTaskFormTask(
|
|
1951
1951
|
input: SaveCompleteTaskFormTaskInput!
|
|
1952
1952
|
): SaveCompleteTaskFormTaskPayload
|
|
1953
|
-
startCase(input: StartCaseInput!): StartCasePayload
|
|
1954
|
-
@deprecated(reason: "Use SaveCase mutation instead")
|
|
1955
1953
|
saveCase(input: SaveCaseInput!): SaveCasePayload
|
|
1956
1954
|
cancelCase(input: CancelCaseInput!): CancelCasePayload
|
|
1957
1955
|
suspendCase(input: SuspendCaseInput!): SuspendCasePayload
|
|
@@ -2484,6 +2482,10 @@ type RemoveFormQuestionPayload {
|
|
|
2484
2482
|
|
|
2485
2483
|
input ReopenCaseInput {
|
|
2486
2484
|
id: ID!
|
|
2485
|
+
|
|
2486
|
+
"""
|
|
2487
|
+
List of work item ids to be readied when the case is reopened
|
|
2488
|
+
"""
|
|
2487
2489
|
workItems: [ID]!
|
|
2488
2490
|
|
|
2489
2491
|
"""
|
|
@@ -2841,18 +2843,13 @@ type SaveDocumentDateAnswerPayload {
|
|
|
2841
2843
|
}
|
|
2842
2844
|
|
|
2843
2845
|
input SaveDocumentFilesAnswerInput {
|
|
2846
|
+
value: [SaveFile]
|
|
2844
2847
|
question: ID!
|
|
2845
2848
|
document: ID!
|
|
2846
2849
|
meta: JSONString
|
|
2847
|
-
value: [SaveFile]
|
|
2848
2850
|
clientMutationId: String
|
|
2849
2851
|
}
|
|
2850
2852
|
|
|
2851
|
-
input SaveFile {
|
|
2852
|
-
id: String
|
|
2853
|
-
name: String
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
2853
|
type SaveDocumentFilesAnswerPayload {
|
|
2857
2854
|
answer: Answer
|
|
2858
2855
|
clientMutationId: String
|
|
@@ -2975,6 +2972,11 @@ type SaveDynamicMultipleChoiceQuestionPayload {
|
|
|
2975
2972
|
clientMutationId: String
|
|
2976
2973
|
}
|
|
2977
2974
|
|
|
2975
|
+
input SaveFile {
|
|
2976
|
+
id: String
|
|
2977
|
+
name: String
|
|
2978
|
+
}
|
|
2979
|
+
|
|
2978
2980
|
input SaveFilesQuestionInput {
|
|
2979
2981
|
slug: String!
|
|
2980
2982
|
label: String!
|
|
@@ -3280,9 +3282,16 @@ type SaveWorkItemPayload {
|
|
|
3280
3282
|
|
|
3281
3283
|
"""
|
|
3282
3284
|
Lookup type to search in answers.
|
|
3285
|
+
|
|
3286
|
+
You may pass in a list of question slugs and/or a list of form slugs to define
|
|
3287
|
+
which answers to search. If you pass in one or more forms, answers to the
|
|
3288
|
+
questions in that form will be searched. If you pass in one or more question
|
|
3289
|
+
slug, the corresponding answers are searched. If you pass both, a superset
|
|
3290
|
+
of both is searched (ie. they do not limit each other).
|
|
3283
3291
|
"""
|
|
3284
3292
|
input SearchAnswersFilterType {
|
|
3285
|
-
questions: [ID]
|
|
3293
|
+
questions: [ID]
|
|
3294
|
+
forms: [ID]
|
|
3286
3295
|
value: GenericScalar!
|
|
3287
3296
|
lookup: SearchLookupMode
|
|
3288
3297
|
}
|
|
@@ -3393,13 +3402,8 @@ enum SortableAnswerAttributes {
|
|
|
3393
3402
|
enum SortableCaseAttributes {
|
|
3394
3403
|
CREATED_AT
|
|
3395
3404
|
MODIFIED_AT
|
|
3396
|
-
ALLOW_ALL_FORMS
|
|
3397
|
-
DESCRIPTION
|
|
3398
|
-
IS_ARCHIVED
|
|
3399
|
-
IS_PUBLISHED
|
|
3400
|
-
NAME
|
|
3401
3405
|
STATUS
|
|
3402
|
-
|
|
3406
|
+
DOCUMENT__FORM__NAME
|
|
3403
3407
|
}
|
|
3404
3408
|
|
|
3405
3409
|
enum SortableDocumentAttributes {
|
|
@@ -3458,12 +3462,10 @@ enum SortableQuestionAttributes {
|
|
|
3458
3462
|
enum SortableTaskAttributes {
|
|
3459
3463
|
CREATED_AT
|
|
3460
3464
|
MODIFIED_AT
|
|
3461
|
-
ALLOW_ALL_FORMS
|
|
3462
3465
|
LEAD_TIME
|
|
3463
3466
|
TYPE
|
|
3464
3467
|
DESCRIPTION
|
|
3465
3468
|
IS_ARCHIVED
|
|
3466
|
-
IS_PUBLISHED
|
|
3467
3469
|
NAME
|
|
3468
3470
|
SLUG
|
|
3469
3471
|
}
|
|
@@ -3483,32 +3485,12 @@ enum SortableWorkItemAttributes {
|
|
|
3483
3485
|
CREATED_AT
|
|
3484
3486
|
MODIFIED_AT
|
|
3485
3487
|
CLOSED_AT
|
|
3486
|
-
ALLOW_ALL_FORMS
|
|
3487
3488
|
DESCRIPTION
|
|
3488
|
-
IS_ARCHIVED
|
|
3489
|
-
IS_PUBLISHED
|
|
3490
3489
|
NAME
|
|
3491
3490
|
DEADLINE
|
|
3492
3491
|
STATUS
|
|
3493
3492
|
SLUG
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
input StartCaseInput {
|
|
3497
|
-
workflow: ID!
|
|
3498
|
-
meta: JSONString
|
|
3499
|
-
parentWorkItem: ID
|
|
3500
|
-
form: ID
|
|
3501
|
-
|
|
3502
|
-
"""
|
|
3503
|
-
Provide extra context for dynamic jexl transforms and events
|
|
3504
|
-
"""
|
|
3505
|
-
context: JSONString
|
|
3506
|
-
clientMutationId: String
|
|
3507
|
-
}
|
|
3508
|
-
|
|
3509
|
-
type StartCasePayload {
|
|
3510
|
-
case: Case
|
|
3511
|
-
clientMutationId: String
|
|
3493
|
+
CASE__DOCUMENT__FORM__NAME
|
|
3512
3494
|
}
|
|
3513
3495
|
|
|
3514
3496
|
"""
|
|
@@ -4047,6 +4029,13 @@ type WorkItem implements Node {
|
|
|
4047
4029
|
first: Int
|
|
4048
4030
|
last: Int
|
|
4049
4031
|
): WorkItemConnection!
|
|
4032
|
+
|
|
4033
|
+
"""
|
|
4034
|
+
This property potentially performs poorly if used in a large setof entries, as
|
|
4035
|
+
the evaluation of the redoable jexl configurationcannot be performed on the
|
|
4036
|
+
database level. Please use carefully.
|
|
4037
|
+
"""
|
|
4038
|
+
isRedoable: Boolean
|
|
4050
4039
|
}
|
|
4051
4040
|
|
|
4052
4041
|
type WorkItemConnection {
|
|
@@ -4105,6 +4094,7 @@ input WorkItemFilterSetType {
|
|
|
4105
4094
|
caseDocumentHasAnswer: [HasAnswerFilterType]
|
|
4106
4095
|
caseMetaValue: [JSONValueFilterType]
|
|
4107
4096
|
rootCaseMetaValue: [JSONValueFilterType]
|
|
4097
|
+
caseSearchAnswers: [SearchAnswersFilterType]
|
|
4108
4098
|
invert: Boolean
|
|
4109
4099
|
}
|
|
4110
4100
|
|
|
@@ -73,6 +73,7 @@ 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
79
|
server.create("task", { slug: "inquiry" });
|
|
@@ -225,10 +226,17 @@ export function reviseInquiry(server, { inquiry }) {
|
|
|
225
226
|
}
|
|
226
227
|
|
|
227
228
|
export function createCase(server, { group }) {
|
|
229
|
+
const distributionWorkItem = server.create("work-item", {
|
|
230
|
+
taskId: "distribution",
|
|
231
|
+
status: "READY",
|
|
232
|
+
case: server.create("case"),
|
|
233
|
+
});
|
|
234
|
+
|
|
228
235
|
const distributionCase = server.create("case", {
|
|
229
236
|
id: "4222ab21-9c89-47de-98be-d62a8ed0ebeb",
|
|
230
237
|
status: "RUNNING",
|
|
231
238
|
workflowId: "distribution",
|
|
239
|
+
parentWorkItem: distributionWorkItem,
|
|
232
240
|
});
|
|
233
241
|
|
|
234
242
|
server.create("work-item", {
|
|
@@ -389,4 +397,6 @@ export default function (server, groups) {
|
|
|
389
397
|
status: "inquiry-answer-status-positive",
|
|
390
398
|
}),
|
|
391
399
|
});
|
|
400
|
+
|
|
401
|
+
return distributionCase;
|
|
392
402
|
}
|
|
@@ -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
|
});
|
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.24",
|
|
4
4
|
"description": "Ember addon for testing with Caluma addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@ember/string": "^3.0.0",
|
|
18
|
-
"@faker-js/faker": "^7.
|
|
18
|
+
"@faker-js/faker": "^7.4.0",
|
|
19
19
|
"broccoli-funnel": "^3.0.8",
|
|
20
20
|
"broccoli-merge-trees": "^4.2.0",
|
|
21
21
|
"ember-apollo-client": "~4.0.2",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"ember-cli-babel": "^7.26.11",
|
|
24
24
|
"ember-cli-htmlbars": "^6.1.0",
|
|
25
25
|
"ember-cli-mirage": "^3.0.0-alpha.3",
|
|
26
|
-
"ember-fetch": "^8.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",
|