@@ -10,17 +10,19 @@ import setupIntlRenderingTest from '../../../../helpers/setup-intl-rendering';
10
10
module (' Integration | Component | users | user-detail-personal-information | authentication-method' , function (hooks ) {
11
11
setupIntlRenderingTest (hooks);
12
12
13
- module (' When the admin member has access to users actions scope' , function () {
14
- class AccessControlStub extends Service {
13
+ module (' When the admin member has access to users actions scope' , function (hooks ) {
14
+ const stub = class AccessControlStub extends Service {
15
15
hasAccessToUsersActionsScope = true ;
16
- }
16
+ };
17
+ hooks .beforeEach (function () {
18
+ this .owner .register (' service:access-control' , stub);
19
+ });
17
20
18
21
module (' When user has authentication methods' , function () {
19
22
module (' when user has confirmed his email address' , function () {
20
23
test (' should display email confirmed date' , async function (assert ) {
21
24
// given
22
25
const user = { emailConfirmedAt: new Date (' 2020-10-30' ), authenticationMethods: [] };
23
- this .owner .register (' service:access-control' , AccessControlStub);
24
26
25
27
// when
26
28
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -44,7 +46,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
44
46
test (' it should display "Adresse e-mail non confirmée"' , async function (assert ) {
45
47
// given
46
48
const user = { emailConfirmedAt: null , authenticationMethods: [] };
47
- this .owner .register (' service:access-control' , AccessControlStub);
48
49
49
50
// when
50
51
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -71,7 +72,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
71
72
},
72
73
],
73
74
};
74
- this .owner .register (' service:access-control' , AccessControlStub);
75
75
76
76
// when
77
77
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -102,8 +102,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
102
102
],
103
103
};
104
104
105
- this .owner .register (' service:access-control' , AccessControlStub);
106
-
107
105
// when
108
106
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
109
107
@@ -133,7 +131,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
133
131
},
134
132
],
135
133
};
136
- this .owner .register (' service:access-control' , AccessControlStub);
137
134
138
135
// when
139
136
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -159,7 +156,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
159
156
test (' should display information' , async function (assert ) {
160
157
// given
161
158
const user = { email: ' pix.aile@example.net' , authenticationMethods: [{ identityProvider: ' PIX' }] };
162
- this .owner .register (' service:access-control' , AccessControlStub);
163
159
164
160
// when
165
161
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -173,7 +169,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
173
169
test (' should display information' , async function (assert ) {
174
170
// given
175
171
const user = { authenticationMethods: [] };
176
- this .owner .register (' service:access-control' , AccessControlStub);
177
172
178
173
// when
179
174
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -191,7 +186,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
191
186
test (' should display information' , async function (assert ) {
192
187
// given
193
188
const user = { username: ' PixAile' , authenticationMethods: [{ identityProvider: ' PIX' }] };
194
- this .owner .register (' service:access-control' , AccessControlStub);
195
189
196
190
// when
197
191
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -205,7 +199,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
205
199
test (' should display information' , async function (assert ) {
206
200
// given
207
201
const user = { authenticationMethods: [] };
208
- this .owner .register (' service:access-control' , AccessControlStub);
209
202
210
203
// when
211
204
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -223,7 +216,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
223
216
test (' should display information and reassign authentication method button' , async function (assert ) {
224
217
// given
225
218
const user = { authenticationMethods: [{ identityProvider: ' GAR' }] };
226
- this .owner .register (' service:access-control' , AccessControlStub);
227
219
228
220
// when
229
221
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -238,7 +230,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
238
230
test (' should display information' , async function (assert ) {
239
231
// given
240
232
const user = { username: ' PixAile' , authenticationMethods: [{ identityProvider: ' PIX' }] };
241
- this .owner .register (' service:access-control' , AccessControlStub);
242
233
243
234
// when
244
235
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -265,7 +256,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
265
256
test (' should display information' , async function (assert ) {
266
257
// given
267
258
const user = { authenticationMethods: [] };
268
- this .owner .register (' service:access-control' , AccessControlStub);
269
259
this .owner .register (' service:oidc-identity-providers' , OidcIdentityProvidersStub);
270
260
271
261
// when
@@ -287,7 +277,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
287
277
authenticationMethods: [{ identityProvider: ' PIX' }, { identityProvider: ' SUNLIGHT_NAVIGATIONS' }],
288
278
};
289
279
290
- this .owner .register (' service:access-control' , AccessControlStub);
291
280
this .owner .register (' service:oidc-identity-providers' , OidcIdentityProvidersStub);
292
281
293
282
// when
@@ -312,7 +301,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
312
301
authenticationMethods: [{ identityProvider: ' PIX' }],
313
302
};
314
303
315
- this .owner .register (' service:access-control' , AccessControlStub);
316
304
this .owner .register (' service:oidc-identity-providers' , OidcIdentityProvidersStub);
317
305
318
306
// when
@@ -340,7 +328,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
340
328
test (' it should not display a remove authentication method link' , async function (assert ) {
341
329
// given
342
330
const user = { username: ' PixAile' , authenticationMethods: [{ identityProvider: ' PIX' }] };
343
- this .owner .register (' service:access-control' , AccessControlStub);
344
331
345
332
// when
346
333
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -367,7 +354,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
367
354
username: ' PixAile' ,
368
355
authenticationMethods: [{ identityProvider: ' SUNLIGHT_NAVIGATIONS' }],
369
356
};
370
- this .owner .register (' service:access-control' , AccessControlStub);
371
357
372
358
// when
373
359
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -383,7 +369,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
383
369
const user = {
384
370
authenticationMethods: [],
385
371
};
386
- this .owner .register (' service:access-control' , AccessControlStub);
387
372
388
373
// when
389
374
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -397,7 +382,6 @@ module('Integration | Component | users | user-detail-personal-information | aut
397
382
test (' it should not display add authentication method button' , async function (assert ) {
398
383
// given
399
384
const user = { username: ' PixAile' , authenticationMethods: [{ identityProvider: ' PIX' }] };
400
- this .owner .register (' service:access-control' , AccessControlStub);
401
385
402
386
// when
403
387
const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
@@ -408,6 +392,37 @@ module('Integration | Component | users | user-detail-personal-information | aut
408
392
});
409
393
});
410
394
});
395
+
396
+ test (' it displays last application connections' , async function (assert ) {
397
+ // given
398
+ const store = this .owner .lookup (' service:store' );
399
+ const user = store .createRecord (' user' , {
400
+ username: ' PixAile' ,
401
+ authenticationMethods: [store .createRecord (' authentication-method' , { identityProvider: ' PIX' })],
402
+ lastApplicationConnections: [
403
+ store .createRecord (' last-application-connection' , {
404
+ application: ' app' ,
405
+ lastLoggedAt: new Date (' 2022-05-01T00:00:00Z' ),
406
+ }),
407
+ store .createRecord (' last-application-connection' , {
408
+ application: ' orga' ,
409
+ lastLoggedAt: new Date (' 2022-01-01T00:00:00Z' ),
410
+ }),
411
+ store .createRecord (' last-application-connection' , {
412
+ application: ' certif' ,
413
+ lastLoggedAt: new Date (' 2022-02-01T00:00:00Z' ),
414
+ }),
415
+ ],
416
+ });
417
+
418
+ // when
419
+ const screen = await render (<template ><AuthenticationMethod @ user ={{user }} /></template >);
420
+
421
+ // then
422
+ assert .dom (screen .getByText (' Date de dernière connexion Pix App : 01/05/2022' )).exists ();
423
+ assert .dom (screen .getByText (' Date de dernière connexion Pix Orga : 01/01/2022' )).exists ();
424
+ assert .dom (screen .getByText (' Date de dernière connexion Pix Certif : 01/02/2022' )).exists ();
425
+ });
411
426
});
412
427
413
428
module (' When the admin member does not have access to users actions scope' , function () {
0 commit comments