@whook/oauth2 10.0.1 → 10.0.4

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.
Files changed (33) hide show
  1. package/dist/handlers/getOAuth2Authorize.test.js +5 -5
  2. package/dist/handlers/getOAuth2Authorize.test.js.map +1 -1
  3. package/dist/handlers/postAuthLogin.test.js +15 -15
  4. package/dist/handlers/postAuthLogin.test.js.map +1 -1
  5. package/dist/handlers/postAuthLogout.test.js +7 -7
  6. package/dist/handlers/postAuthLogout.test.js.map +1 -1
  7. package/dist/handlers/postAuthRefresh.test.js +17 -17
  8. package/dist/handlers/postAuthRefresh.test.js.map +1 -1
  9. package/dist/handlers/postOAuth2Acknowledge.test.js +7 -7
  10. package/dist/handlers/postOAuth2Acknowledge.test.js.map +1 -1
  11. package/dist/handlers/postOAuth2Token.test.js +3 -3
  12. package/dist/handlers/postOAuth2Token.test.js.map +1 -1
  13. package/dist/index.test.js +27 -27
  14. package/dist/index.test.js.map +1 -1
  15. package/dist/services/authCookies.test.js +5 -4
  16. package/dist/services/authCookies.test.js.map +1 -1
  17. package/dist/services/oAuth2CodeGranter.test.js +5 -5
  18. package/dist/services/oAuth2CodeGranter.test.js.map +1 -1
  19. package/package.json +19 -20
  20. package/src/__snapshots__/index.test.ts.snap +147 -147
  21. package/src/handlers/__snapshots__/getOAuth2Authorize.test.ts.snap +18 -18
  22. package/src/handlers/__snapshots__/postOAuth2Acknowledge.test.ts.snap +25 -25
  23. package/src/handlers/__snapshots__/postOAuth2Token.test.ts.snap +16 -16
  24. package/src/handlers/getOAuth2Authorize.test.ts +5 -5
  25. package/src/handlers/postAuthLogin.test.ts +15 -15
  26. package/src/handlers/postAuthLogout.test.ts +7 -7
  27. package/src/handlers/postAuthRefresh.test.ts +17 -17
  28. package/src/handlers/postOAuth2Acknowledge.test.ts +7 -7
  29. package/src/handlers/postOAuth2Token.test.ts +3 -3
  30. package/src/index.test.ts +37 -27
  31. package/src/services/__snapshots__/oAuth2CodeGranter.test.ts.snap +15 -15
  32. package/src/services/authCookies.test.ts +5 -4
  33. package/src/services/oAuth2CodeGranter.test.ts +5 -5
@@ -1,28 +1,28 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`postOAuth2Token should create a token 1`] = `
4
- Object {
5
- "logCalls": Array [],
6
- "oAuth2AccessTokenCreateCalls": Array [
7
- Array [
8
- Object {
4
+ {
5
+ "logCalls": [],
6
+ "oAuth2AccessTokenCreateCalls": [
7
+ [
8
+ {
9
9
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
10
10
  "scope": "user",
11
11
  },
12
12
  undefined,
13
13
  ],
14
14
  ],
15
- "oAuth2RefreshTokenCreateCalls": Array [
16
- Array [
17
- Object {
15
+ "oAuth2RefreshTokenCreateCalls": [
16
+ [
17
+ {
18
18
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
19
19
  "scope": "user",
20
20
  },
21
21
  undefined,
22
22
  ],
23
23
  ],
24
- "response": Object {
25
- "body": Object {
24
+ "response": {
25
+ "body": {
26
26
  "access_token": "an_access_token",
27
27
  "expiration_date": "2010-03-07T00:00:00.000Z",
28
28
  "expires_in": 86400,
@@ -31,22 +31,22 @@ Object {
31
31
  "refresh_token_expires_in": 5364748800,
32
32
  "token_type": "bearer",
33
33
  },
34
- "headers": Object {},
34
+ "headers": {},
35
35
  "status": 200,
36
36
  },
37
37
  }
38
38
  `;
39
39
 
40
40
  exports[`postOAuth2Token should fail with a bad grant type 2`] = `
41
- Object {
42
- "logCalls": Array [
43
- Array [
41
+ {
42
+ "logCalls": [
43
+ [
44
44
  "debug",
45
45
  "👫 - OAuth2 token issuing error",
46
46
  "E_UNKNOWN_AUTHENTICATOR_TYPE",
47
47
  ],
48
48
  ],
49
- "oAuth2AccessTokenCreateCalls": Array [],
50
- "oAuth2RefreshTokenCreateCalls": Array [],
49
+ "oAuth2AccessTokenCreateCalls": [],
50
+ "oAuth2RefreshTokenCreateCalls": [],
51
51
  }
52
52
  `;
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, beforeEach, jest, expect } from '@jest/globals';
2
2
  import initGetOAuth2Authorize from './getOAuth2Authorize.js';
3
3
  import { DEFAULT_ERRORS_DESCRIPTORS } from '@whook/whook';
4
4
  import { OAUTH2_ERRORS_DESCRIPTORS } from '../services/oAuth2Granters.js';
@@ -106,8 +106,8 @@ describe('getOAuth2Authorize', () => {
106
106
  });
107
107
 
108
108
  expect(response).toMatchInlineSnapshot(`
109
- Object {
110
- "headers": Object {
109
+ {
110
+ "headers": {
111
111
  "location": "https://auth.example.com/sign_in?type=code&redirect_uri=http%3A%2F%2Flol&scope=user&client_id=abbacaca-abba-caca-abba-cacaabbacaca&state=bancal",
112
112
  },
113
113
  "status": 302,
@@ -154,8 +154,8 @@ describe('getOAuth2Authorize', () => {
154
154
  });
155
155
 
156
156
  expect(response).toMatchInlineSnapshot(`
157
- Object {
158
- "headers": Object {
157
+ {
158
+ "headers": {
159
159
  "location": "https://auth.example.com/sign_in?redirect_uri=https%3A%2F%2Fwww.example.com&error=unsupported_response_type&error_decription=The+type+%22yolo%22+is+not+supported.&state=bancal",
160
160
  },
161
161
  "status": 302,
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, jest, expect } from '@jest/globals';
2
2
  import initPostAuthLogin from './postAuthLogin.js';
3
3
  import type { AuthCookiesService } from '../services/authCookies.js';
4
4
 
@@ -42,28 +42,28 @@ describe('postAuthLogin', () => {
42
42
  authCookiesBuildCalls: authCookies.build.mock.calls,
43
43
  postOAuth2TokenCalls: postOAuth2Token.mock.calls,
44
44
  }).toMatchInlineSnapshot(`
45
- Object {
46
- "authCookiesBuildCalls": Array [
47
- Array [
48
- Object {
45
+ {
46
+ "authCookiesBuildCalls": [
47
+ [
48
+ {
49
49
  "access_token": "an_access_token",
50
50
  "expiration_date": "2020-02-02T20:22:02Z",
51
51
  "expires_in": 3600,
52
52
  "token_type": "bearer",
53
53
  },
54
- Object {
54
+ {
55
55
  "session": true,
56
56
  },
57
57
  ],
58
58
  ],
59
- "postOAuth2TokenCalls": Array [
60
- Array [
61
- Object {
62
- "authenticationData": Object {
59
+ "postOAuth2TokenCalls": [
60
+ [
61
+ {
62
+ "authenticationData": {
63
63
  "applicationId": "root_app_id",
64
64
  "scope": "user",
65
65
  },
66
- "body": Object {
66
+ "body": {
67
67
  "grant_type": "password",
68
68
  "password": "a_password",
69
69
  "scope": "user",
@@ -72,15 +72,15 @@ describe('postAuthLogin', () => {
72
72
  },
73
73
  ],
74
74
  ],
75
- "response": Object {
76
- "body": Object {
75
+ "response": {
76
+ "body": {
77
77
  "access_token": "an_access_token",
78
78
  "expiration_date": "2020-02-02T20:22:02Z",
79
79
  "expires_in": 3600,
80
80
  "token_type": "bearer",
81
81
  },
82
- "headers": Object {
83
- "Set-Cookie": Array [
82
+ "headers": {
83
+ "Set-Cookie": [
84
84
  "the_build_cookies",
85
85
  ],
86
86
  },
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, jest, expect } from '@jest/globals';
2
2
  import initPostAuthLogout from './postAuthLogout.js';
3
3
  import type { AuthCookiesService } from '../services/authCookies.js';
4
4
 
@@ -19,13 +19,13 @@ describe('postAuthLogout', () => {
19
19
  response,
20
20
  authCookiesBuildCalls: authCookies.build.mock.calls,
21
21
  }).toMatchInlineSnapshot(`
22
- Object {
23
- "authCookiesBuildCalls": Array [
24
- Array [],
22
+ {
23
+ "authCookiesBuildCalls": [
24
+ [],
25
25
  ],
26
- "response": Object {
27
- "headers": Object {
28
- "Set-Cookie": Array [
26
+ "response": {
27
+ "headers": {
28
+ "Set-Cookie": [
29
29
  "the_build_cookies",
30
30
  ],
31
31
  },
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, jest, expect } from '@jest/globals';
2
2
  import initPostAuthRefresh from './postAuthRefresh.js';
3
3
  import type { AuthCookiesService } from '../services/authCookies.js';
4
4
 
@@ -47,33 +47,33 @@ describe('postAuthRefresh', () => {
47
47
  authCookiesBuildCalls: authCookies.build.mock.calls,
48
48
  postOAuth2TokenCalls: postOAuth2Token.mock.calls,
49
49
  }).toMatchInlineSnapshot(`
50
- Object {
51
- "authCookiesBuildCalls": Array [
52
- Array [
53
- Object {
50
+ {
51
+ "authCookiesBuildCalls": [
52
+ [
53
+ {
54
54
  "access_token": "an_access_token",
55
55
  "expiration_date": "2020-02-02T20:22:02Z",
56
56
  "expires_in": 3600,
57
57
  "token_type": "bearer",
58
58
  },
59
- Object {
59
+ {
60
60
  "session": true,
61
61
  },
62
62
  ],
63
63
  ],
64
- "authCookiesParseCalls": Array [
65
- Array [
64
+ "authCookiesParseCalls": [
65
+ [
66
66
  "a_given_cookie",
67
67
  ],
68
68
  ],
69
- "postOAuth2TokenCalls": Array [
70
- Array [
71
- Object {
72
- "authenticationData": Object {
69
+ "postOAuth2TokenCalls": [
70
+ [
71
+ {
72
+ "authenticationData": {
73
73
  "applicationId": "root_app_id",
74
74
  "scope": "user",
75
75
  },
76
- "body": Object {
76
+ "body": {
77
77
  "grant_type": "refresh_token",
78
78
  "refresh_token": "a_refresh_token",
79
79
  "scope": "user",
@@ -81,15 +81,15 @@ describe('postAuthRefresh', () => {
81
81
  },
82
82
  ],
83
83
  ],
84
- "response": Object {
85
- "body": Object {
84
+ "response": {
85
+ "body": {
86
86
  "access_token": "an_access_token",
87
87
  "expiration_date": "2020-02-02T20:22:02Z",
88
88
  "expires_in": 3600,
89
89
  "token_type": "bearer",
90
90
  },
91
- "headers": Object {
92
- "Set-Cookie": Array [
91
+ "headers": {
92
+ "Set-Cookie": [
93
93
  "the_build_cookies",
94
94
  ],
95
95
  },
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, beforeEach, jest, expect } from '@jest/globals';
2
2
  import initPostOAuth2Acknowledge from './postOAuth2Acknowledge.js';
3
3
  import { YError } from 'yerror';
4
4
  import { DEFAULT_ERRORS_DESCRIPTORS } from '@whook/whook';
@@ -135,9 +135,9 @@ describe('postOAuth2Acknowledge', () => {
135
135
  expect({
136
136
  response,
137
137
  }).toMatchInlineSnapshot(`
138
- Object {
139
- "response": Object {
140
- "headers": Object {
138
+ {
139
+ "response": {
140
+ "headers": {
141
141
  "location": "https://www.example.com/?client_id=abbacaca-abba-caca-abba-cacaabbacaca&scope=user&state=bancal&redirect_uri=http%3A%2F%2Flol&user_id=1",
142
142
  },
143
143
  "status": 302,
@@ -196,9 +196,9 @@ describe('postOAuth2Acknowledge', () => {
196
196
  expect({
197
197
  response,
198
198
  }).toMatchInlineSnapshot(`
199
- Object {
200
- "response": Object {
201
- "headers": Object {
199
+ {
200
+ "response": {
201
+ "headers": {
202
202
  "location": "https://www.example.com/?error=unsupported_response_type&error_decription=Type+%22yolo%22+not+supported.",
203
203
  },
204
204
  "status": 302,
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, test, beforeEach, jest, expect } from '@jest/globals';
2
2
  import initPostOAuth2Token from './postOAuth2Token.js';
3
3
  import { YError } from 'yerror';
4
4
  import type { LogService, TimeService } from 'common-services';
@@ -196,9 +196,9 @@ describe('postOAuth2Token', () => {
196
196
  errorCode: (err as YError).code,
197
197
  errorParams: (err as YError).params,
198
198
  }).toMatchInlineSnapshot(`
199
- Object {
199
+ {
200
200
  "errorCode": "E_UNKNOWN_AUTHENTICATOR_TYPE",
201
- "errorParams": Array [
201
+ "errorParams": [
202
202
  "yolo",
203
203
  ],
204
204
  }
package/src/index.test.ts CHANGED
@@ -1,4 +1,12 @@
1
- import { jest } from '@jest/globals';
1
+ import {
2
+ describe,
3
+ it,
4
+ beforeAll,
5
+ beforeEach,
6
+ afterAll,
7
+ jest,
8
+ expect,
9
+ } from '@jest/globals';
2
10
  import {
3
11
  runServer,
4
12
  prepareServer,
@@ -348,8 +356,8 @@ describe('OAuth2 server', () => {
348
356
 
349
357
  data,
350
358
  }).toMatchInlineSnapshot(`
351
- Object {
352
- "data": Object {
359
+ {
360
+ "data": {
353
361
  "access_token": "an_access_token",
354
362
  "expiration_date": "2010-03-07T00:00:00.000Z",
355
363
  "expires_in": 86400,
@@ -358,13 +366,13 @@ describe('OAuth2 server', () => {
358
366
  "refresh_token_expires_in": 5364748800,
359
367
  "token_type": "bearer",
360
368
  },
361
- "headers": Object {
369
+ "headers": {
362
370
  "connection": "close",
363
371
  "content-type": "application/json",
364
372
  "date": undefined,
365
373
  "transaction-id": "0",
366
374
  "transfer-encoding": "chunked",
367
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
375
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
368
376
  },
369
377
  "status": 200,
370
378
  }
@@ -445,8 +453,8 @@ describe('OAuth2 server', () => {
445
453
 
446
454
  data,
447
455
  }).toMatchInlineSnapshot(`
448
- Object {
449
- "data": Object {
456
+ {
457
+ "data": {
450
458
  "access_token": "an_access_token",
451
459
  "expiration_date": "2010-03-07T00:00:00.000Z",
452
460
  "expires_in": 86400,
@@ -455,13 +463,13 @@ describe('OAuth2 server', () => {
455
463
  "refresh_token_expires_in": 5364748800,
456
464
  "token_type": "bearer",
457
465
  },
458
- "headers": Object {
466
+ "headers": {
459
467
  "connection": "close",
460
468
  "content-type": "application/json",
461
469
  "date": undefined,
462
470
  "transaction-id": "1",
463
471
  "transfer-encoding": "chunked",
464
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
472
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
465
473
  },
466
474
  "status": 200,
467
475
  }
@@ -537,8 +545,8 @@ describe('OAuth2 server', () => {
537
545
 
538
546
  data,
539
547
  }).toMatchInlineSnapshot(`
540
- Object {
541
- "data": Object {
548
+ {
549
+ "data": {
542
550
  "access_token": "an_access_token",
543
551
  "expiration_date": "2010-03-07T00:00:00.000Z",
544
552
  "expires_in": 86400,
@@ -547,13 +555,13 @@ describe('OAuth2 server', () => {
547
555
  "refresh_token_expires_in": 5364748800,
548
556
  "token_type": "bearer",
549
557
  },
550
- "headers": Object {
558
+ "headers": {
551
559
  "connection": "close",
552
560
  "content-type": "application/json",
553
561
  "date": undefined,
554
562
  "transaction-id": "2",
555
563
  "transfer-encoding": "chunked",
556
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
564
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
557
565
  },
558
566
  "status": 200,
559
567
  }
@@ -617,11 +625,12 @@ describe('OAuth2 server', () => {
617
625
  // Erasing the Date header that may be added by Axios :/
618
626
  date: undefined,
619
627
  },
628
+
620
629
  data,
621
630
  }).toMatchInlineSnapshot(`
622
- Object {
631
+ {
623
632
  "data": "",
624
- "headers": Object {
633
+ "headers": {
625
634
  "connection": "close",
626
635
  "date": undefined,
627
636
  "location": "https://auth.example.com/sign_in?type=code&redirect_uri=https%3A%2F%2Fexample.com%2Foauth2%2Fcallback%3Fa_param%3Da_param_value&scope=user&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&state=xyz",
@@ -697,15 +706,15 @@ describe('OAuth2 server', () => {
697
706
 
698
707
  data,
699
708
  }).toMatchInlineSnapshot(`
700
- Object {
709
+ {
701
710
  "data": "",
702
- "headers": Object {
711
+ "headers": {
703
712
  "connection": "close",
704
713
  "date": undefined,
705
714
  "location": "http://redirect.example.com/yolo?a_param=a_value&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&scope=user&state=xyz&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo%3Fa_param%3Da_value&code=a_code",
706
715
  "transaction-id": "4",
707
716
  "transfer-encoding": "chunked",
708
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
717
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
709
718
  },
710
719
  "status": 302,
711
720
  }
@@ -784,8 +793,8 @@ describe('OAuth2 server', () => {
784
793
 
785
794
  data,
786
795
  }).toMatchInlineSnapshot(`
787
- Object {
788
- "data": Object {
796
+ {
797
+ "data": {
789
798
  "access_token": "an_access_token",
790
799
  "expiration_date": "2010-03-07T00:00:00.000Z",
791
800
  "expires_in": 86400,
@@ -794,13 +803,13 @@ describe('OAuth2 server', () => {
794
803
  "refresh_token_expires_in": 5364748800,
795
804
  "token_type": "bearer",
796
805
  },
797
- "headers": Object {
806
+ "headers": {
798
807
  "connection": "close",
799
808
  "content-type": "application/json",
800
809
  "date": undefined,
801
810
  "transaction-id": "5",
802
811
  "transfer-encoding": "chunked",
803
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
812
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
804
813
  },
805
814
  "status": 200,
806
815
  }
@@ -862,11 +871,12 @@ describe('OAuth2 server', () => {
862
871
  // Erasing the Date header that may be added by Axios :/
863
872
  date: undefined,
864
873
  },
874
+
865
875
  data,
866
876
  }).toMatchInlineSnapshot(`
867
- Object {
877
+ {
868
878
  "data": "",
869
- "headers": Object {
879
+ "headers": {
870
880
  "connection": "close",
871
881
  "date": undefined,
872
882
  "location": "https://auth.example.com/sign_in?type=token&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo&scope=user&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&state=xyz",
@@ -951,15 +961,15 @@ describe('OAuth2 server', () => {
951
961
 
952
962
  data,
953
963
  }).toMatchInlineSnapshot(`
954
- Object {
964
+ {
955
965
  "data": "",
956
- "headers": Object {
966
+ "headers": {
957
967
  "connection": "close",
958
968
  "date": undefined,
959
969
  "location": "http://redirect.example.com/yolo?a_param=a_value&client_id=acdc41ce-acdc-41ce-acdc-41ceacdc41ce&scope=user&state=xyz&redirect_uri=http%3A%2F%2Fredirect.example.com%2Fyolo&access_token=an_access_token&token_type=bearer&expires_in=86400",
960
970
  "transaction-id": "7",
961
971
  "transfer-encoding": "chunked",
962
- "x-authenticated": "{\\"applicationId\\":\\"acdc41ce-acdc-41ce-acdc-41ceacdc41ce\\",\\"scope\\":\\"user,oauth\\",\\"userId\\":\\"2\\"}",
972
+ "x-authenticated": "{"applicationId":"acdc41ce-acdc-41ce-acdc-41ceacdc41ce","scope":"user,oauth","userId":"2"}",
963
973
  },
964
974
  "status": 302,
965
975
  }
@@ -1,33 +1,33 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
3
  exports[`OAuth2CodeGranter should work with a complete valid flow 2`] = `
4
- Object {
5
- "checkApplicationCalls": Array [
6
- Array [
7
- Object {
4
+ {
5
+ "checkApplicationCalls": [
6
+ [
7
+ {
8
8
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
9
9
  "redirectURI": "https://www.example.com/oauth2/code",
10
10
  "scope": "user",
11
11
  "type": "code",
12
12
  },
13
13
  ],
14
- Array [
15
- Object {
14
+ [
15
+ {
16
16
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
17
17
  "scope": "",
18
18
  "type": "code",
19
19
  },
20
20
  ],
21
21
  ],
22
- "logCalls": Array [
23
- Array [
22
+ "logCalls": [
23
+ [
24
24
  "debug",
25
25
  "👫 - OAuth2CodeGranter Service Initialized!",
26
26
  ],
27
27
  ],
28
- "oAuth2CodeCheckCalls": Array [
29
- Array [
30
- Object {
28
+ "oAuth2CodeCheckCalls": [
29
+ [
30
+ {
31
31
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
32
32
  "scope": "user",
33
33
  },
@@ -35,14 +35,14 @@ Object {
35
35
  "https://www.example.com/oauth2/code",
36
36
  ],
37
37
  ],
38
- "oAuth2CodeCreateCalls": Array [
39
- Array [
40
- Object {
38
+ "oAuth2CodeCreateCalls": [
39
+ [
40
+ {
41
41
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
42
42
  "scope": "user",
43
43
  },
44
44
  "https://www.example.com/oauth2/code",
45
- Object {},
45
+ {},
46
46
  ],
47
47
  ],
48
48
  }
@@ -1,3 +1,4 @@
1
+ import { describe, test, expect } from '@jest/globals';
1
2
  import initAuthCookies from './authCookies.js';
2
3
  import type { AuthCookiesConfig } from './authCookies.js';
3
4
 
@@ -20,7 +21,7 @@ describe('authCookies', () => {
20
21
  });
21
22
 
22
23
  expect(result).toMatchInlineSnapshot(`
23
- Array [
24
+ [
24
25
  "access_token=a_access_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
25
26
  "refresh_token=a_refresh_token; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
26
27
  ]
@@ -44,7 +45,7 @@ describe('authCookies', () => {
44
45
  });
45
46
 
46
47
  expect(result).toMatchInlineSnapshot(`
47
- Array [
48
+ [
48
49
  "access_token=; Max-Age=0; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
49
50
  "refresh_token=; Domain=api.example.com; Path=/auth; HttpOnly; Secure; SameSite=Strict",
50
51
  ]
@@ -65,7 +66,7 @@ describe('authCookies', () => {
65
66
 
66
67
  const result = await authCookies.parse('');
67
68
 
68
- expect(result).toMatchInlineSnapshot(`Object {}`);
69
+ expect(result).toMatchInlineSnapshot(`{}`);
69
70
  });
70
71
  test('should work with cookies', async () => {
71
72
  const ENV = {};
@@ -83,7 +84,7 @@ describe('authCookies', () => {
83
84
  );
84
85
 
85
86
  expect(result).toMatchInlineSnapshot(`
86
- Object {
87
+ {
87
88
  "access_token": "a_access_token",
88
89
  "refresh_token": "a_refresh_token",
89
90
  }
@@ -1,4 +1,4 @@
1
- import { jest } from '@jest/globals';
1
+ import { describe, it, beforeEach, jest, expect } from '@jest/globals';
2
2
  import { BaseAuthenticationData } from '@whook/authorization';
3
3
  import initOAuth2CodeGranter from './oAuth2CodeGranter.js';
4
4
  import {
@@ -89,19 +89,19 @@ describe('OAuth2CodeGranter', () => {
89
89
  acknowledgerResult,
90
90
  authenticatorResult,
91
91
  }).toMatchInlineSnapshot(`
92
- Object {
93
- "acknowledgerResult": Object {
92
+ {
93
+ "acknowledgerResult": {
94
94
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
95
95
  "code": "yolo",
96
96
  "redirectURI": "https://www.example.com/oauth2/code",
97
97
  "scope": "user",
98
98
  },
99
- "authenticatorResult": Object {
99
+ "authenticatorResult": {
100
100
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
101
101
  "redirectURI": "https://www.example2.com",
102
102
  "scope": "user",
103
103
  },
104
- "authorizerResult": Object {
104
+ "authorizerResult": {
105
105
  "applicationId": "abbacaca-abba-caca-abba-cacaabbacaca",
106
106
  "redirectURI": "https://www.example.com",
107
107
  "scope": "user",