Skip to content

Commit 160203b

Browse files
author
Jesus Hernandez
committed
Updated tests
1 parent 7a89a79 commit 160203b

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ with optional overrides.
132132

133133
#### result
134134

135-
This is the result from the auth server
135+
This is the result from the auth server:
136136

137137
- **accessToken** - (`string`) the access token
138138
- **accessTokenExpirationDate** - (`string`) the token expiration date
@@ -142,6 +142,7 @@ This is the result from the auth server
142142
- **refreshToken** - (`string`) the refresh token
143143
- **tokenType** - (`string`) the token type, e.g. Bearer
144144
- **scopes** - ([`string`]) the scopes the user has agreed to be granted
145+
- **authorizationCode** - (`string`) the authorization code (only if `skipCodeExchange=true`)
145146

146147
### `refresh`
147148

index.spec.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ describe('AppAuth', () => {
4141
useNonce: true,
4242
usePKCE: true,
4343
customHeaders: null,
44+
skipCodeExchange: false,
4445
};
4546

4647
const registerConfig = {
@@ -380,11 +381,37 @@ describe('AppAuth', () => {
380381
config.scopes,
381382
config.additionalParameters,
382383
config.serviceConfiguration,
384+
config.skipCodeExchange,
383385
config.useNonce,
384386
config.usePKCE
385387
);
386388
});
387389

390+
it('calls the native wrapper with the default value `false`, `true`, `true`', () => {
391+
authorize({
392+
issuer: 'test-issuer',
393+
redirectUrl: 'test-redirectUrl',
394+
clientId: 'test-clientId',
395+
clientSecret: 'test-clientSecret',
396+
customHeaders: null,
397+
additionalParameters: null,
398+
serviceConfiguration: null,
399+
scopes: ['openid'],
400+
});
401+
expect(mockAuthorize).toHaveBeenCalledWith(
402+
'test-issuer',
403+
'test-redirectUrl',
404+
'test-clientId',
405+
'test-clientSecret',
406+
['openid'],
407+
null,
408+
null,
409+
false,
410+
true,
411+
true
412+
);
413+
});
414+
388415
describe('Android-specific', () => {
389416
beforeEach(() => {
390417
require('react-native').Platform.OS = 'android';
@@ -404,6 +431,7 @@ describe('AppAuth', () => {
404431
config.scopes,
405432
config.additionalParameters,
406433
config.serviceConfiguration,
434+
config.skipCodeExchange,
407435
config.usePKCE,
408436
config.clientAuthMethod,
409437
false,
@@ -421,6 +449,7 @@ describe('AppAuth', () => {
421449
config.scopes,
422450
config.additionalParameters,
423451
config.serviceConfiguration,
452+
false,
424453
config.usePKCE,
425454
config.clientAuthMethod,
426455
false,
@@ -438,6 +467,7 @@ describe('AppAuth', () => {
438467
config.scopes,
439468
config.additionalParameters,
440469
config.serviceConfiguration,
470+
false,
441471
config.usePKCE,
442472
config.clientAuthMethod,
443473
true,
@@ -464,6 +494,7 @@ describe('AppAuth', () => {
464494
config.scopes,
465495
config.additionalParameters,
466496
config.serviceConfiguration,
497+
false,
467498
config.usePKCE,
468499
config.clientAuthMethod,
469500
false,
@@ -619,6 +650,7 @@ describe('AppAuth', () => {
619650
config.scopes,
620651
config.additionalParameters,
621652
config.serviceConfiguration,
653+
false,
622654
config.usePKCE,
623655
config.clientAuthMethod,
624656
false,
@@ -643,6 +675,7 @@ describe('AppAuth', () => {
643675
config.scopes,
644676
config.additionalParameters,
645677
config.serviceConfiguration,
678+
false,
646679
true,
647680
true
648681
);
@@ -659,6 +692,7 @@ describe('AppAuth', () => {
659692
config.additionalParameters,
660693
config.serviceConfiguration,
661694
false,
695+
false,
662696
true
663697
);
664698
});
@@ -679,6 +713,7 @@ describe('AppAuth', () => {
679713
config.scopes,
680714
config.additionalParameters,
681715
config.serviceConfiguration,
716+
config.skipCodeExchange,
682717
config.useNonce,
683718
true
684719
);
@@ -694,6 +729,7 @@ describe('AppAuth', () => {
694729
config.scopes,
695730
config.additionalParameters,
696731
config.serviceConfiguration,
732+
config.skipCodeExchange,
697733
config.useNonce,
698734
false
699735
);

0 commit comments

Comments
 (0)