@connectid-tools/idp-selector-react 6.10.0 → 6.11.0-alpha.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.
- package/Benefits.d.ts +2 -2
- package/Benefits.js +14 -14
- package/CidButton.d.ts +3 -3
- package/CidButton.js +58 -48
- package/CidButtonHowItWorks.js +9 -9
- package/CidButtonInfo.js +4 -4
- package/FullProcess.js +4 -4
- package/IdpLogoList.d.ts +2 -2
- package/IdpLogoList.js +6 -6
- package/IntroText.d.ts +2 -2
- package/IntroText.js +11 -11
- package/LearnMore.js +9 -9
- package/NoIdpError.js +3 -3
- package/Popup.d.ts +3 -3
- package/Popup.js +53 -43
- package/Process.js +7 -7
- package/README.md +7 -0
- package/ThemeContext.d.ts +1 -1
- package/analytics.d.ts +1 -1
- package/certification.d.ts +1 -1
- package/certification.js +15 -15
- package/certification.test.js +225 -225
- package/compatibility.d.ts +1 -1
- package/compatibility.test.js +25 -25
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +4 -2
- package/userAgent.d.ts +1 -1
- package/validator.d.ts +1 -1
- package/validator.test.js +20 -20
- package/incognito.d.ts +0 -41
- package/incognito.js +0 -239
package/certification.test.js
CHANGED
|
@@ -1,427 +1,427 @@
|
|
|
1
|
-
import assert from
|
|
2
|
-
import { describe, it } from
|
|
3
|
-
import { filterAuthorisationServerByClaims, filterAuthorisationServerByDevice, filterAuthorisationServers, getManualAuthorisationServer, hasCertification, removeExpiredOrNotStartedCertifications, } from
|
|
4
|
-
describe(
|
|
5
|
-
it(
|
|
1
|
+
import assert from "node:assert";
|
|
2
|
+
import { describe, it } from "node:test";
|
|
3
|
+
import { filterAuthorisationServerByClaims, filterAuthorisationServerByDevice, filterAuthorisationServers, getManualAuthorisationServer, hasCertification, removeExpiredOrNotStartedCertifications, } from "./certification.js";
|
|
4
|
+
describe("filterAuthorisationServers", () => {
|
|
5
|
+
it("should return all authorisation servers if showAllParticipants is true regardless of certification status, required certifications and claims", () => {
|
|
6
6
|
const authorisationServers = [
|
|
7
7
|
// no certifications at all
|
|
8
8
|
{
|
|
9
|
-
AuthorisationServerId:
|
|
10
|
-
CustomerFriendlyLogoUri:
|
|
11
|
-
CustomerFriendlyName:
|
|
9
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b21",
|
|
10
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
11
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
12
12
|
AuthorisationServerCertifications: [],
|
|
13
13
|
},
|
|
14
14
|
];
|
|
15
|
-
assert.deepStrictEqual(filterAuthorisationServers(authorisationServers, true,
|
|
15
|
+
assert.deepStrictEqual(filterAuthorisationServers(authorisationServers, true, "Active", ["email"], ["TDIF.IDP"]), authorisationServers);
|
|
16
16
|
});
|
|
17
|
-
it(
|
|
18
|
-
Object.defineProperty(global,
|
|
17
|
+
it("should filter authorisation servers if showAllParticipants is false", () => {
|
|
18
|
+
Object.defineProperty(global, "navigator", { value: { userAgent: "xxxdesktop" }, configurable: true });
|
|
19
19
|
const authorisationServers = [
|
|
20
20
|
// no certifications at all
|
|
21
21
|
{
|
|
22
|
-
AuthorisationServerId:
|
|
23
|
-
CustomerFriendlyLogoUri:
|
|
24
|
-
CustomerFriendlyName:
|
|
22
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b21",
|
|
23
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
24
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
25
25
|
AuthorisationServerCertifications: [],
|
|
26
26
|
},
|
|
27
27
|
// expired
|
|
28
28
|
{
|
|
29
|
-
AuthorisationServerId:
|
|
30
|
-
CustomerFriendlyLogoUri:
|
|
31
|
-
CustomerFriendlyName:
|
|
29
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b22",
|
|
30
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
31
|
+
CustomerFriendlyName: "Mock Bank C",
|
|
32
32
|
AuthorisationServerCertifications: [
|
|
33
33
|
{
|
|
34
|
-
CertificationStartDate:
|
|
35
|
-
CertificationExpirationDate:
|
|
36
|
-
Status:
|
|
37
|
-
ProfileVariant:
|
|
38
|
-
ProfileType:
|
|
34
|
+
CertificationStartDate: "10/04/1900",
|
|
35
|
+
CertificationExpirationDate: "10/04/2000",
|
|
36
|
+
Status: "Certified",
|
|
37
|
+
ProfileVariant: "FAPI2 Adv. OP w/Private Key, PAR",
|
|
38
|
+
ProfileType: "Redirect",
|
|
39
39
|
},
|
|
40
40
|
],
|
|
41
41
|
},
|
|
42
42
|
// fapi2, web and email claim
|
|
43
43
|
{
|
|
44
|
-
AuthorisationServerId:
|
|
45
|
-
CustomerFriendlyLogoUri:
|
|
46
|
-
CustomerFriendlyName:
|
|
44
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b23",
|
|
45
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
46
|
+
CustomerFriendlyName: "Mock Bank D",
|
|
47
47
|
AuthorisationServerCertifications: [
|
|
48
48
|
{
|
|
49
|
-
CertificationStartDate:
|
|
50
|
-
CertificationExpirationDate:
|
|
51
|
-
Status:
|
|
52
|
-
ProfileVariant:
|
|
53
|
-
ProfileType:
|
|
49
|
+
CertificationStartDate: "10/04/1900",
|
|
50
|
+
CertificationExpirationDate: "10/04/2099",
|
|
51
|
+
Status: "Certified",
|
|
52
|
+
ProfileVariant: "FAPI2 Adv. OP w/Private Key, PAR",
|
|
53
|
+
ProfileType: "Redirect",
|
|
54
54
|
},
|
|
55
55
|
{
|
|
56
|
-
CertificationStartDate:
|
|
57
|
-
CertificationExpirationDate:
|
|
58
|
-
Status:
|
|
59
|
-
ProfileVariant:
|
|
60
|
-
ProfileType:
|
|
56
|
+
CertificationStartDate: "10/04/1900",
|
|
57
|
+
CertificationExpirationDate: "10/04/2099",
|
|
58
|
+
Status: "Certified",
|
|
59
|
+
ProfileVariant: "web",
|
|
60
|
+
ProfileType: "Channel",
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
|
-
CertificationStartDate:
|
|
64
|
-
CertificationExpirationDate:
|
|
65
|
-
Status:
|
|
66
|
-
ProfileVariant:
|
|
67
|
-
ProfileType:
|
|
63
|
+
CertificationStartDate: "10/04/1900",
|
|
64
|
+
CertificationExpirationDate: "10/04/2099",
|
|
65
|
+
Status: "Certified",
|
|
66
|
+
ProfileVariant: "email",
|
|
67
|
+
ProfileType: "ConnectID Claims",
|
|
68
68
|
},
|
|
69
69
|
],
|
|
70
70
|
},
|
|
71
71
|
// fapi2, web and birthdate claim
|
|
72
72
|
{
|
|
73
|
-
AuthorisationServerId:
|
|
74
|
-
CustomerFriendlyLogoUri:
|
|
75
|
-
CustomerFriendlyName:
|
|
73
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b24",
|
|
74
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
75
|
+
CustomerFriendlyName: "Mock Bank E",
|
|
76
76
|
AuthorisationServerCertifications: [
|
|
77
77
|
{
|
|
78
|
-
CertificationStartDate:
|
|
79
|
-
CertificationExpirationDate:
|
|
80
|
-
Status:
|
|
81
|
-
ProfileVariant:
|
|
82
|
-
ProfileType:
|
|
78
|
+
CertificationStartDate: "10/04/1900",
|
|
79
|
+
CertificationExpirationDate: "10/04/2099",
|
|
80
|
+
Status: "Certified",
|
|
81
|
+
ProfileVariant: "FAPI2 Adv. OP w/Private Key, PAR",
|
|
82
|
+
ProfileType: "Redirect",
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
CertificationStartDate:
|
|
86
|
-
CertificationExpirationDate:
|
|
87
|
-
Status:
|
|
88
|
-
ProfileVariant:
|
|
89
|
-
ProfileType:
|
|
85
|
+
CertificationStartDate: "10/04/1900",
|
|
86
|
+
CertificationExpirationDate: "10/04/2099",
|
|
87
|
+
Status: "Certified",
|
|
88
|
+
ProfileVariant: "web",
|
|
89
|
+
ProfileType: "Channel",
|
|
90
90
|
},
|
|
91
91
|
{
|
|
92
|
-
CertificationStartDate:
|
|
93
|
-
CertificationExpirationDate:
|
|
94
|
-
Status:
|
|
95
|
-
ProfileVariant:
|
|
96
|
-
ProfileType:
|
|
92
|
+
CertificationStartDate: "10/04/1900",
|
|
93
|
+
CertificationExpirationDate: "10/04/2099",
|
|
94
|
+
Status: "Certified",
|
|
95
|
+
ProfileVariant: "birthdate",
|
|
96
|
+
ProfileType: "ConnectID Claims",
|
|
97
97
|
},
|
|
98
98
|
],
|
|
99
99
|
},
|
|
100
100
|
];
|
|
101
|
-
assert.deepStrictEqual(filterAuthorisationServers(authorisationServers, false,
|
|
101
|
+
assert.deepStrictEqual(filterAuthorisationServers(authorisationServers, false, "Active", ["email"], ["Redirect.FAPI2"]), [authorisationServers[2]]);
|
|
102
102
|
});
|
|
103
103
|
});
|
|
104
|
-
describe(
|
|
104
|
+
describe("getManualAuthorisationServer", () => {
|
|
105
105
|
const authorisationServers = [
|
|
106
106
|
{
|
|
107
|
-
AuthorisationServerId:
|
|
108
|
-
CustomerFriendlyLogoUri:
|
|
109
|
-
CustomerFriendlyName:
|
|
107
|
+
AuthorisationServerId: "71fe3927-f596-4192-ab9a-f6644cdb9b2b",
|
|
108
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
109
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
110
110
|
// expired
|
|
111
111
|
AuthorisationServerCertifications: [
|
|
112
112
|
{
|
|
113
|
-
CertificationExpirationDate:
|
|
114
|
-
Status:
|
|
115
|
-
ProfileVariant:
|
|
113
|
+
CertificationExpirationDate: "10/04/2000",
|
|
114
|
+
Status: "Certified",
|
|
115
|
+
ProfileVariant: "Fallback Identity Service Provider",
|
|
116
116
|
// @ts-ignore
|
|
117
|
-
ProfileType:
|
|
117
|
+
ProfileType: "ConnectID",
|
|
118
118
|
},
|
|
119
119
|
],
|
|
120
120
|
},
|
|
121
121
|
];
|
|
122
|
-
it(
|
|
122
|
+
it("should return expired manual servers if showAllParticipants is true", () => {
|
|
123
123
|
assert.deepStrictEqual(getManualAuthorisationServer(authorisationServers, true), authorisationServers[0]);
|
|
124
124
|
});
|
|
125
|
-
it(
|
|
125
|
+
it("should not return expired manual servers if showAllParticipants is false", () => {
|
|
126
126
|
assert.deepStrictEqual(getManualAuthorisationServer(authorisationServers, false), undefined);
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
|
-
describe(
|
|
129
|
+
describe("filterAuthorisationServerByClaims", () => {
|
|
130
130
|
const authorisationServers = [
|
|
131
131
|
{
|
|
132
|
-
AuthorisationServerId:
|
|
133
|
-
CustomerFriendlyLogoUri:
|
|
134
|
-
CustomerFriendlyName:
|
|
132
|
+
AuthorisationServerId: "1",
|
|
133
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
134
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
135
135
|
AuthorisationServerCertifications: [
|
|
136
136
|
{
|
|
137
|
-
CertificationStartDate:
|
|
138
|
-
CertificationExpirationDate:
|
|
139
|
-
Status:
|
|
140
|
-
ProfileVariant:
|
|
141
|
-
ProfileType:
|
|
137
|
+
CertificationStartDate: "10/04/1900",
|
|
138
|
+
CertificationExpirationDate: "10/04/2099",
|
|
139
|
+
Status: "Certified",
|
|
140
|
+
ProfileVariant: "email",
|
|
141
|
+
ProfileType: "ConnectID Claims",
|
|
142
142
|
},
|
|
143
143
|
],
|
|
144
144
|
},
|
|
145
145
|
{
|
|
146
|
-
AuthorisationServerId:
|
|
147
|
-
CustomerFriendlyLogoUri:
|
|
148
|
-
CustomerFriendlyName:
|
|
146
|
+
AuthorisationServerId: "2",
|
|
147
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
148
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
149
149
|
// no claims
|
|
150
150
|
AuthorisationServerCertifications: [],
|
|
151
151
|
},
|
|
152
152
|
{
|
|
153
|
-
AuthorisationServerId:
|
|
154
|
-
CustomerFriendlyLogoUri:
|
|
155
|
-
CustomerFriendlyName:
|
|
153
|
+
AuthorisationServerId: "3",
|
|
154
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
155
|
+
CustomerFriendlyName: "Mock Bank C",
|
|
156
156
|
AuthorisationServerCertifications: [
|
|
157
157
|
// multiple claims
|
|
158
158
|
{
|
|
159
|
-
CertificationStartDate:
|
|
160
|
-
CertificationExpirationDate:
|
|
161
|
-
Status:
|
|
162
|
-
ProfileVariant:
|
|
163
|
-
ProfileType:
|
|
159
|
+
CertificationStartDate: "10/04/1900",
|
|
160
|
+
CertificationExpirationDate: "10/04/2099",
|
|
161
|
+
Status: "Certified",
|
|
162
|
+
ProfileVariant: "email",
|
|
163
|
+
ProfileType: "ConnectID Claims",
|
|
164
164
|
},
|
|
165
165
|
{
|
|
166
|
-
CertificationStartDate:
|
|
167
|
-
CertificationExpirationDate:
|
|
168
|
-
Status:
|
|
169
|
-
ProfileVariant:
|
|
170
|
-
ProfileType:
|
|
166
|
+
CertificationStartDate: "10/04/1900",
|
|
167
|
+
CertificationExpirationDate: "10/04/2099",
|
|
168
|
+
Status: "Certified",
|
|
169
|
+
ProfileVariant: "birthdate",
|
|
170
|
+
ProfileType: "ConnectID Claims",
|
|
171
171
|
},
|
|
172
172
|
{
|
|
173
|
-
CertificationStartDate:
|
|
174
|
-
CertificationExpirationDate:
|
|
175
|
-
Status:
|
|
176
|
-
ProfileVariant:
|
|
177
|
-
ProfileType:
|
|
173
|
+
CertificationStartDate: "10/04/1900",
|
|
174
|
+
CertificationExpirationDate: "10/04/2099",
|
|
175
|
+
Status: "Certified",
|
|
176
|
+
ProfileVariant: "name",
|
|
177
|
+
ProfileType: "ConnectID Claims",
|
|
178
178
|
},
|
|
179
179
|
],
|
|
180
180
|
},
|
|
181
181
|
];
|
|
182
|
-
it(
|
|
183
|
-
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, [
|
|
182
|
+
it("should return no authorisation servers when claim is address", () => {
|
|
183
|
+
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, ["address"]), []);
|
|
184
184
|
});
|
|
185
|
-
it(
|
|
186
|
-
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, [
|
|
185
|
+
it("should return bank C and A when claim email", () => {
|
|
186
|
+
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, ["email"]), [
|
|
187
187
|
authorisationServers[0],
|
|
188
188
|
authorisationServers[2],
|
|
189
189
|
]);
|
|
190
190
|
});
|
|
191
|
-
it(
|
|
192
|
-
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, [
|
|
191
|
+
it("should return bank C when claim is email and birthdate", () => {
|
|
192
|
+
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, ["email", "birthdate"]), [
|
|
193
193
|
authorisationServers[2],
|
|
194
194
|
]);
|
|
195
195
|
});
|
|
196
|
-
it(
|
|
197
|
-
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, [
|
|
196
|
+
it("should return bank C when claim is given_name, middle_name and birthdate", () => {
|
|
197
|
+
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, ["given_name", "middle_name", "birthdate"]), [authorisationServers[2]]);
|
|
198
198
|
});
|
|
199
|
-
it(
|
|
200
|
-
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, [
|
|
199
|
+
it("should return bank C when claim is name", () => {
|
|
200
|
+
assert.deepStrictEqual(filterAuthorisationServerByClaims(authorisationServers, ["given_name"]), [
|
|
201
201
|
authorisationServers[2],
|
|
202
202
|
]);
|
|
203
203
|
});
|
|
204
204
|
});
|
|
205
|
-
describe(
|
|
206
|
-
it(
|
|
205
|
+
describe("removeExpiredCertifications", () => {
|
|
206
|
+
it("should remove expired or not started certifications", () => {
|
|
207
207
|
const authorisationServers = [
|
|
208
208
|
{
|
|
209
|
-
AuthorisationServerId:
|
|
210
|
-
CustomerFriendlyLogoUri:
|
|
211
|
-
CustomerFriendlyName:
|
|
209
|
+
AuthorisationServerId: "1",
|
|
210
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
211
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
212
212
|
AuthorisationServerCertifications: [
|
|
213
213
|
// certified and not expired
|
|
214
214
|
{
|
|
215
|
-
CertificationStartDate:
|
|
216
|
-
CertificationExpirationDate:
|
|
217
|
-
Status:
|
|
218
|
-
ProfileVariant:
|
|
219
|
-
ProfileType:
|
|
215
|
+
CertificationStartDate: "10/04/1900",
|
|
216
|
+
CertificationExpirationDate: "10/04/2099",
|
|
217
|
+
Status: "Certified",
|
|
218
|
+
ProfileVariant: "web",
|
|
219
|
+
ProfileType: "Channel",
|
|
220
220
|
},
|
|
221
221
|
// not certified and not expired
|
|
222
222
|
{
|
|
223
|
-
CertificationStartDate:
|
|
224
|
-
CertificationExpirationDate:
|
|
225
|
-
Status:
|
|
226
|
-
ProfileVariant:
|
|
227
|
-
ProfileType:
|
|
223
|
+
CertificationStartDate: "10/04/1900",
|
|
224
|
+
CertificationExpirationDate: "10/04/2099",
|
|
225
|
+
Status: "Deprecated",
|
|
226
|
+
ProfileVariant: "FAPI2 Adv. OP w/Private Key, PAR",
|
|
227
|
+
ProfileType: "Redirect",
|
|
228
228
|
},
|
|
229
229
|
],
|
|
230
230
|
},
|
|
231
231
|
{
|
|
232
|
-
AuthorisationServerId:
|
|
233
|
-
CustomerFriendlyLogoUri:
|
|
234
|
-
CustomerFriendlyName:
|
|
232
|
+
AuthorisationServerId: "2",
|
|
233
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
234
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
235
235
|
// no certifications
|
|
236
236
|
AuthorisationServerCertifications: [],
|
|
237
237
|
},
|
|
238
238
|
{
|
|
239
|
-
AuthorisationServerId:
|
|
240
|
-
CustomerFriendlyLogoUri:
|
|
241
|
-
CustomerFriendlyName:
|
|
239
|
+
AuthorisationServerId: "3",
|
|
240
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
241
|
+
CustomerFriendlyName: "Mock Bank C",
|
|
242
242
|
AuthorisationServerCertifications: [
|
|
243
243
|
// certified but expired
|
|
244
244
|
{
|
|
245
|
-
CertificationStartDate:
|
|
246
|
-
CertificationExpirationDate:
|
|
247
|
-
Status:
|
|
248
|
-
ProfileVariant:
|
|
249
|
-
ProfileType:
|
|
245
|
+
CertificationStartDate: "10/04/1900",
|
|
246
|
+
CertificationExpirationDate: "10/04/2000",
|
|
247
|
+
Status: "Certified",
|
|
248
|
+
ProfileVariant: "web",
|
|
249
|
+
ProfileType: "Channel",
|
|
250
250
|
},
|
|
251
251
|
],
|
|
252
252
|
},
|
|
253
253
|
{
|
|
254
|
-
AuthorisationServerId:
|
|
255
|
-
CustomerFriendlyLogoUri:
|
|
256
|
-
CustomerFriendlyName:
|
|
254
|
+
AuthorisationServerId: "4",
|
|
255
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
256
|
+
CustomerFriendlyName: "Mock Bank D",
|
|
257
257
|
AuthorisationServerCertifications: [
|
|
258
258
|
// certified and not expired but not started
|
|
259
259
|
{
|
|
260
|
-
CertificationStartDate:
|
|
261
|
-
CertificationExpirationDate:
|
|
262
|
-
Status:
|
|
263
|
-
ProfileVariant:
|
|
264
|
-
ProfileType:
|
|
260
|
+
CertificationStartDate: "10/04/2098",
|
|
261
|
+
CertificationExpirationDate: "10/04/2099",
|
|
262
|
+
Status: "Certified",
|
|
263
|
+
ProfileVariant: "web",
|
|
264
|
+
ProfileType: "Channel",
|
|
265
265
|
},
|
|
266
266
|
],
|
|
267
267
|
},
|
|
268
268
|
];
|
|
269
269
|
const expected = [
|
|
270
270
|
{
|
|
271
|
-
AuthorisationServerId:
|
|
272
|
-
CustomerFriendlyLogoUri:
|
|
273
|
-
CustomerFriendlyName:
|
|
271
|
+
AuthorisationServerId: "1",
|
|
272
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
273
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
274
274
|
AuthorisationServerCertifications: [
|
|
275
275
|
// certified and not expired
|
|
276
276
|
{
|
|
277
|
-
CertificationStartDate:
|
|
278
|
-
CertificationExpirationDate:
|
|
279
|
-
Status:
|
|
280
|
-
ProfileVariant:
|
|
281
|
-
ProfileType:
|
|
277
|
+
CertificationStartDate: "10/04/1900",
|
|
278
|
+
CertificationExpirationDate: "10/04/2099",
|
|
279
|
+
Status: "Certified",
|
|
280
|
+
ProfileVariant: "web",
|
|
281
|
+
ProfileType: "Channel",
|
|
282
282
|
},
|
|
283
283
|
],
|
|
284
284
|
},
|
|
285
285
|
{
|
|
286
|
-
AuthorisationServerId:
|
|
287
|
-
CustomerFriendlyLogoUri:
|
|
288
|
-
CustomerFriendlyName:
|
|
286
|
+
AuthorisationServerId: "2",
|
|
287
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
288
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
289
289
|
// no certifications
|
|
290
290
|
AuthorisationServerCertifications: [],
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
|
-
AuthorisationServerId:
|
|
294
|
-
CustomerFriendlyLogoUri:
|
|
295
|
-
CustomerFriendlyName:
|
|
293
|
+
AuthorisationServerId: "3",
|
|
294
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
295
|
+
CustomerFriendlyName: "Mock Bank C",
|
|
296
296
|
AuthorisationServerCertifications: [],
|
|
297
297
|
},
|
|
298
298
|
{
|
|
299
|
-
AuthorisationServerId:
|
|
300
|
-
CustomerFriendlyLogoUri:
|
|
301
|
-
CustomerFriendlyName:
|
|
299
|
+
AuthorisationServerId: "4",
|
|
300
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
301
|
+
CustomerFriendlyName: "Mock Bank D",
|
|
302
302
|
AuthorisationServerCertifications: [],
|
|
303
303
|
},
|
|
304
304
|
];
|
|
305
305
|
assert.deepStrictEqual(removeExpiredOrNotStartedCertifications(authorisationServers), expected);
|
|
306
306
|
});
|
|
307
307
|
});
|
|
308
|
-
describe(
|
|
309
|
-
it(
|
|
308
|
+
describe("filterAuthorisationServerByDevice", () => {
|
|
309
|
+
it("should return all authorisation servers for mobile", () => {
|
|
310
310
|
const authorisationServers = [
|
|
311
311
|
{
|
|
312
|
-
AuthorisationServerId:
|
|
313
|
-
CustomerFriendlyLogoUri:
|
|
314
|
-
CustomerFriendlyName:
|
|
312
|
+
AuthorisationServerId: "1",
|
|
313
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
314
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
315
315
|
AuthorisationServerCertifications: [
|
|
316
316
|
{
|
|
317
|
-
ProfileType:
|
|
318
|
-
ProfileVariant:
|
|
319
|
-
CertificationExpirationDate:
|
|
320
|
-
Status:
|
|
321
|
-
CertificationStartDate:
|
|
317
|
+
ProfileType: "Channel",
|
|
318
|
+
ProfileVariant: "app",
|
|
319
|
+
CertificationExpirationDate: "10/04/2099",
|
|
320
|
+
Status: "Certified",
|
|
321
|
+
CertificationStartDate: "10/04/1900",
|
|
322
322
|
},
|
|
323
323
|
],
|
|
324
324
|
},
|
|
325
325
|
{
|
|
326
|
-
AuthorisationServerId:
|
|
327
|
-
CustomerFriendlyLogoUri:
|
|
328
|
-
CustomerFriendlyName:
|
|
326
|
+
AuthorisationServerId: "2",
|
|
327
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
328
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
329
329
|
AuthorisationServerCertifications: [
|
|
330
330
|
{
|
|
331
|
-
ProfileType:
|
|
332
|
-
ProfileVariant:
|
|
333
|
-
CertificationExpirationDate:
|
|
334
|
-
Status:
|
|
335
|
-
CertificationStartDate:
|
|
331
|
+
ProfileType: "Channel",
|
|
332
|
+
ProfileVariant: "web",
|
|
333
|
+
CertificationExpirationDate: "10/04/2099",
|
|
334
|
+
Status: "Certified",
|
|
335
|
+
CertificationStartDate: "10/04/1900",
|
|
336
336
|
},
|
|
337
337
|
],
|
|
338
338
|
},
|
|
339
339
|
];
|
|
340
|
-
assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers,
|
|
340
|
+
assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers, "mobile"), authorisationServers);
|
|
341
341
|
});
|
|
342
|
-
it(
|
|
342
|
+
it("should return all authorisation servers except those with only app certification when desktop", () => {
|
|
343
343
|
const authorisationServers = [
|
|
344
344
|
{
|
|
345
|
-
AuthorisationServerId:
|
|
346
|
-
CustomerFriendlyLogoUri:
|
|
347
|
-
CustomerFriendlyName:
|
|
345
|
+
AuthorisationServerId: "1",
|
|
346
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
347
|
+
CustomerFriendlyName: "Mock Bank A",
|
|
348
348
|
// has only app certification (removed)
|
|
349
349
|
AuthorisationServerCertifications: [
|
|
350
350
|
{
|
|
351
|
-
ProfileType:
|
|
352
|
-
ProfileVariant:
|
|
353
|
-
CertificationExpirationDate:
|
|
354
|
-
Status:
|
|
355
|
-
CertificationStartDate:
|
|
351
|
+
ProfileType: "Channel",
|
|
352
|
+
ProfileVariant: "app",
|
|
353
|
+
CertificationExpirationDate: "10/04/2099",
|
|
354
|
+
Status: "Certified",
|
|
355
|
+
CertificationStartDate: "10/04/1900",
|
|
356
356
|
},
|
|
357
357
|
],
|
|
358
358
|
},
|
|
359
359
|
{
|
|
360
|
-
AuthorisationServerId:
|
|
361
|
-
CustomerFriendlyLogoUri:
|
|
362
|
-
CustomerFriendlyName:
|
|
360
|
+
AuthorisationServerId: "2",
|
|
361
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
362
|
+
CustomerFriendlyName: "Mock Bank B",
|
|
363
363
|
AuthorisationServerCertifications: [
|
|
364
364
|
{
|
|
365
|
-
ProfileType:
|
|
366
|
-
ProfileVariant:
|
|
367
|
-
CertificationExpirationDate:
|
|
368
|
-
Status:
|
|
369
|
-
CertificationStartDate:
|
|
365
|
+
ProfileType: "Channel",
|
|
366
|
+
ProfileVariant: "web",
|
|
367
|
+
CertificationExpirationDate: "10/04/2099",
|
|
368
|
+
Status: "Certified",
|
|
369
|
+
CertificationStartDate: "10/04/1900",
|
|
370
370
|
},
|
|
371
371
|
],
|
|
372
372
|
},
|
|
373
373
|
{
|
|
374
|
-
AuthorisationServerId:
|
|
375
|
-
CustomerFriendlyLogoUri:
|
|
376
|
-
CustomerFriendlyName:
|
|
374
|
+
AuthorisationServerId: "3",
|
|
375
|
+
CustomerFriendlyLogoUri: "https://static.sandbox.connectid.com.au/BankA.svg",
|
|
376
|
+
CustomerFriendlyName: "Mock Bank C",
|
|
377
377
|
// has web and app certifications (okay)
|
|
378
378
|
AuthorisationServerCertifications: [
|
|
379
379
|
{
|
|
380
|
-
ProfileType:
|
|
381
|
-
ProfileVariant:
|
|
382
|
-
CertificationExpirationDate:
|
|
383
|
-
Status:
|
|
384
|
-
CertificationStartDate:
|
|
380
|
+
ProfileType: "Channel",
|
|
381
|
+
ProfileVariant: "app",
|
|
382
|
+
CertificationExpirationDate: "10/04/2099",
|
|
383
|
+
Status: "Certified",
|
|
384
|
+
CertificationStartDate: "10/04/1900",
|
|
385
385
|
},
|
|
386
386
|
{
|
|
387
|
-
ProfileType:
|
|
388
|
-
ProfileVariant:
|
|
389
|
-
CertificationExpirationDate:
|
|
390
|
-
Status:
|
|
391
|
-
CertificationStartDate:
|
|
387
|
+
ProfileType: "Channel",
|
|
388
|
+
ProfileVariant: "web",
|
|
389
|
+
CertificationExpirationDate: "10/04/2099",
|
|
390
|
+
Status: "Certified",
|
|
391
|
+
CertificationStartDate: "10/04/1900",
|
|
392
392
|
},
|
|
393
393
|
],
|
|
394
394
|
},
|
|
395
395
|
];
|
|
396
|
-
assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers,
|
|
396
|
+
assert.deepStrictEqual(filterAuthorisationServerByDevice(authorisationServers, "desktop"), [
|
|
397
397
|
authorisationServers[1],
|
|
398
398
|
authorisationServers[2],
|
|
399
399
|
]);
|
|
400
400
|
});
|
|
401
401
|
});
|
|
402
|
-
describe(
|
|
403
|
-
it(
|
|
402
|
+
describe("hasCertification", () => {
|
|
403
|
+
it("should return true if certifications have channel app", () => {
|
|
404
404
|
const certifications = [
|
|
405
405
|
{
|
|
406
|
-
CertificationStartDate:
|
|
407
|
-
CertificationExpirationDate:
|
|
408
|
-
Status:
|
|
409
|
-
ProfileVariant:
|
|
410
|
-
ProfileType:
|
|
406
|
+
CertificationStartDate: "10/04/1900",
|
|
407
|
+
CertificationExpirationDate: "10/04/2099",
|
|
408
|
+
Status: "Certified",
|
|
409
|
+
ProfileVariant: "app",
|
|
410
|
+
ProfileType: "Channel",
|
|
411
411
|
},
|
|
412
412
|
];
|
|
413
|
-
assert.ok(hasCertification(certifications,
|
|
413
|
+
assert.ok(hasCertification(certifications, "Channel", "app") === true);
|
|
414
414
|
});
|
|
415
|
-
it(
|
|
415
|
+
it("should return false if certifications do not have channel app", () => {
|
|
416
416
|
const certifications = [
|
|
417
417
|
{
|
|
418
|
-
CertificationStartDate:
|
|
419
|
-
CertificationExpirationDate:
|
|
420
|
-
Status:
|
|
421
|
-
ProfileVariant:
|
|
422
|
-
ProfileType:
|
|
418
|
+
CertificationStartDate: "10/04/1900",
|
|
419
|
+
CertificationExpirationDate: "10/04/2099",
|
|
420
|
+
Status: "Certified",
|
|
421
|
+
ProfileVariant: "web",
|
|
422
|
+
ProfileType: "Channel",
|
|
423
423
|
},
|
|
424
424
|
];
|
|
425
|
-
assert.ok(hasCertification(certifications,
|
|
425
|
+
assert.ok(hasCertification(certifications, "Channel", "app") === false);
|
|
426
426
|
});
|
|
427
427
|
});
|