@@ -11,7 +11,7 @@ test('get boom error with default message', (t) => {
11
11
} )
12
12
13
13
test ( 'get boom error with reason' , ( t ) => {
14
- const result = utils . raiseUnauthorized ( null , null , 'foobar' )
14
+ const result = utils . raiseUnauthorized ( null , 'foobar' )
15
15
t . truthy ( result )
16
16
t . deepEqual ( result , boom . unauthorized ( undefined , 'Bearer' , {
17
17
strategy : 'keycloak-jwt' ,
@@ -20,27 +20,28 @@ test('get boom error with reason', (t) => {
20
20
} )
21
21
22
22
test ( 'get boom error with custom scheme' , ( t ) => {
23
- const result = utils . raiseUnauthorized ( null , null , null , 'custom' )
23
+ const result = utils . raiseUnauthorized ( null , null , 'custom' )
24
24
t . truthy ( result )
25
25
t . deepEqual ( result , boom . unauthorized ( undefined , 'custom' , {
26
26
strategy : 'keycloak-jwt'
27
27
} ) )
28
28
} )
29
29
30
30
test ( 'get boom error with default message' , ( t ) => {
31
- const result = utils . raiseUnauthorized ( undefined , 'foobar' )
31
+ const result = utils . raiseUnauthorized ( 'foobar' )
32
32
t . truthy ( result )
33
- t . deepEqual ( result , boom . unauthorized ( 'foobar' , 'Bearer' , {
34
- strategy : 'keycloak-jwt'
33
+ t . deepEqual ( result , boom . unauthorized ( null , 'Bearer' , {
34
+ strategy : 'keycloak-jwt' ,
35
+ error : 'foobar'
35
36
} ) )
36
37
} )
37
38
38
39
test ( 'get boom error with error message' , ( t ) => {
39
- const mockErr = new Error ( 'barfoo' )
40
- const result = utils . raiseUnauthorized ( mockErr , 'foobar' )
40
+ const result = utils . raiseUnauthorized ( 'foobar' )
41
41
t . truthy ( result )
42
- t . deepEqual ( result , boom . unauthorized ( mockErr . message , 'Bearer' , {
43
- strategy : 'keycloak-jwt'
42
+ t . deepEqual ( result , boom . unauthorized ( null , 'Bearer' , {
43
+ strategy : 'keycloak-jwt' ,
44
+ error : 'foobar'
44
45
} ) )
45
46
} )
46
47
0 commit comments