forked from primeroIMS/primero
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconstants.unit.test.js
82 lines (76 loc) · 2.13 KB
/
constants.unit.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) 2014 - 2023 UNICEF. All rights reserved.
import * as recordConstants from "./constants";
describe("<RecordActions /> - Constants", () => {
it("should have known constant", () => {
const constants = { ...recordConstants };
[
"APPROVAL_DIALOG",
"APPROVAL_TYPE",
"ASSIGN_DIALOG",
"EXPORT_DIALOG",
"ENABLED_FOR_ONE",
"ENABLED_FOR_ONE_MANY",
"ENABLED_FOR_ONE_MANY_ALL",
"INCIDENT_DIALOG",
"REFER_DIALOG",
"REQUEST_APPROVAL_DIALOG",
"REQUEST_TYPE",
"SERVICE_DIALOG",
"TRANSFER_DIALOG",
"ID_SEARCH",
"NOTES_DIALOG",
"ENABLE_DISABLE_DIALOG",
"OPEN_CLOSE_DIALOG",
"ONE",
"MANY",
"ALL",
"RECORD_ACTION_ABILITIES",
"MARK_FOR_OFFLINE_DIALOG",
"FILTERS_TO_SKIP"
].forEach(property => {
expect(constants).to.have.property(property);
delete constants[property];
});
expect(constants).to.be.empty;
});
context("when is RECORD_ACTION_ABILITIES", () => {
it("should be an object", () => {
expect(recordConstants.RECORD_ACTION_ABILITIES).to.be.an("object");
});
it("should have the properties", () => {
const recordActionAbilities = { ...recordConstants.RECORD_ACTION_ABILITIES };
[
"canAddIncident",
"canAddNotes",
"canAddService",
"canApprove",
"canApproveActionPlan",
"canApproveBia",
"canApproveCasePlan",
"canApproveClosure",
"canApproveGbvClosure",
"canAssign",
"canCreateIncident",
"canClose",
"canEnable",
"canOnlyExportPdf",
"canRefer",
"canReopen",
"canRequest",
"canRequestActionPlan",
"canRequestBia",
"canRequestCasePlan",
"canRequestClosure",
"canRequestGbvClosure",
"canShowExports",
"canTransfer",
"canMarkForOffline",
"canVerify"
].forEach(property => {
expect(recordActionAbilities).to.have.property(property);
delete recordActionAbilities[property];
});
expect(recordActionAbilities).to.be.empty;
});
});
});