@projectcaluma/ember-testing 11.0.0-beta.10 → 11.0.0-beta.11
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/schema.graphql +20 -19
- package/addon-mirage-support/factories/form.js +4 -0
- package/package.json +2 -2
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
|
}
|
|
@@ -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 {
|
|
@@ -2484,6 +2484,10 @@ type RemoveFormQuestionPayload {
|
|
|
2484
2484
|
|
|
2485
2485
|
input ReopenCaseInput {
|
|
2486
2486
|
id: ID!
|
|
2487
|
+
|
|
2488
|
+
"""
|
|
2489
|
+
List of work item ids to be readied when the case is reopened
|
|
2490
|
+
"""
|
|
2487
2491
|
workItems: [ID]!
|
|
2488
2492
|
|
|
2489
2493
|
"""
|
|
@@ -2841,18 +2845,13 @@ type SaveDocumentDateAnswerPayload {
|
|
|
2841
2845
|
}
|
|
2842
2846
|
|
|
2843
2847
|
input SaveDocumentFilesAnswerInput {
|
|
2848
|
+
value: [SaveFile]
|
|
2844
2849
|
question: ID!
|
|
2845
2850
|
document: ID!
|
|
2846
2851
|
meta: JSONString
|
|
2847
|
-
value: [SaveFile]
|
|
2848
2852
|
clientMutationId: String
|
|
2849
2853
|
}
|
|
2850
2854
|
|
|
2851
|
-
input SaveFile {
|
|
2852
|
-
id: String
|
|
2853
|
-
name: String
|
|
2854
|
-
}
|
|
2855
|
-
|
|
2856
2855
|
type SaveDocumentFilesAnswerPayload {
|
|
2857
2856
|
answer: Answer
|
|
2858
2857
|
clientMutationId: String
|
|
@@ -2975,6 +2974,11 @@ type SaveDynamicMultipleChoiceQuestionPayload {
|
|
|
2975
2974
|
clientMutationId: String
|
|
2976
2975
|
}
|
|
2977
2976
|
|
|
2977
|
+
input SaveFile {
|
|
2978
|
+
id: String
|
|
2979
|
+
name: String
|
|
2980
|
+
}
|
|
2981
|
+
|
|
2978
2982
|
input SaveFilesQuestionInput {
|
|
2979
2983
|
slug: String!
|
|
2980
2984
|
label: String!
|
|
@@ -3280,9 +3284,16 @@ type SaveWorkItemPayload {
|
|
|
3280
3284
|
|
|
3281
3285
|
"""
|
|
3282
3286
|
Lookup type to search in answers.
|
|
3287
|
+
|
|
3288
|
+
You may pass in a list of question slugs and/or a list of form slugs to define
|
|
3289
|
+
which answers to search. If you pass in one or more forms, answers to the
|
|
3290
|
+
questions in that form will be searched. If you pass in one or more question
|
|
3291
|
+
slug, the corresponding answers are searched. If you pass both, a superset
|
|
3292
|
+
of both is searched (ie. they do not limit each other).
|
|
3283
3293
|
"""
|
|
3284
3294
|
input SearchAnswersFilterType {
|
|
3285
|
-
questions: [ID]
|
|
3295
|
+
questions: [ID]
|
|
3296
|
+
forms: [ID]
|
|
3286
3297
|
value: GenericScalar!
|
|
3287
3298
|
lookup: SearchLookupMode
|
|
3288
3299
|
}
|
|
@@ -3393,13 +3404,8 @@ enum SortableAnswerAttributes {
|
|
|
3393
3404
|
enum SortableCaseAttributes {
|
|
3394
3405
|
CREATED_AT
|
|
3395
3406
|
MODIFIED_AT
|
|
3396
|
-
ALLOW_ALL_FORMS
|
|
3397
|
-
DESCRIPTION
|
|
3398
|
-
IS_ARCHIVED
|
|
3399
|
-
IS_PUBLISHED
|
|
3400
|
-
NAME
|
|
3401
3407
|
STATUS
|
|
3402
|
-
|
|
3408
|
+
DOCUMENT__FORM__NAME
|
|
3403
3409
|
}
|
|
3404
3410
|
|
|
3405
3411
|
enum SortableDocumentAttributes {
|
|
@@ -3458,12 +3464,10 @@ enum SortableQuestionAttributes {
|
|
|
3458
3464
|
enum SortableTaskAttributes {
|
|
3459
3465
|
CREATED_AT
|
|
3460
3466
|
MODIFIED_AT
|
|
3461
|
-
ALLOW_ALL_FORMS
|
|
3462
3467
|
LEAD_TIME
|
|
3463
3468
|
TYPE
|
|
3464
3469
|
DESCRIPTION
|
|
3465
3470
|
IS_ARCHIVED
|
|
3466
|
-
IS_PUBLISHED
|
|
3467
3471
|
NAME
|
|
3468
3472
|
SLUG
|
|
3469
3473
|
}
|
|
@@ -3483,10 +3487,7 @@ enum SortableWorkItemAttributes {
|
|
|
3483
3487
|
CREATED_AT
|
|
3484
3488
|
MODIFIED_AT
|
|
3485
3489
|
CLOSED_AT
|
|
3486
|
-
ALLOW_ALL_FORMS
|
|
3487
3490
|
DESCRIPTION
|
|
3488
|
-
IS_ARCHIVED
|
|
3489
|
-
IS_PUBLISHED
|
|
3490
3491
|
NAME
|
|
3491
3492
|
DEADLINE
|
|
3492
3493
|
STATUS
|
|
@@ -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.11",
|
|
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",
|