@@ -4,21 +4,6 @@ const DATA = { key1: 1, value1: 1 }
4
4
const HEADERS = { keyHeader1 : 1 , valueHeader1 : 1 }
5
5
let messaging , ownSrv , extSrv , credentials
6
6
7
- jest . mock ( '@sap/xssec' , ( ) => ( {
8
- createSecurityContext ( token , _credentials , id , cb ) {
9
- if ( token !== 'dummyToken' ) return cb ( null , null , null )
10
- const dummyContext = { }
11
- const tokenInfoObj = { sub : 'eb-client-id' , azp : 'eb-client-id' }
12
- const dummyTokenInfo = {
13
- getPayload : ( ) => tokenInfoObj ,
14
- getClientId : ( ) => 'eb-client-id' ,
15
- getZoneId : ( ) => 'dummyZoneId' ,
16
- ...tokenInfoObj
17
- }
18
- return cb ( null , dummyContext , dummyTokenInfo )
19
- }
20
- } ) )
21
-
22
7
const mockHttps = {
23
8
handleHttpReq : ( ) => {
24
9
throw new Error ( 'must be implemented by test' )
@@ -89,14 +74,14 @@ describe('event-broker service with ias auth for single tenant scenario', () =>
89
74
test ( 'request without JWT token' , async ( ) => {
90
75
await expect ( POST ( `/-/cds/event-broker/webhook` ) ) . rejects . toHaveProperty (
91
76
'message' ,
92
- 'Request failed with status code 401'
77
+ expect . stringMatching ( 'Request failed with status code 401' )
93
78
)
94
79
} )
95
80
96
81
test ( 'request with invalid JWT token' , async ( ) => {
97
82
await expect (
98
83
POST ( `/-/cds/event-broker/webhook` , { some : 'data' } , { headers : { Authorization : 'Bearer invalidtoken' } } )
99
- ) . rejects . toHaveProperty ( 'message' , 'Request failed with status code 401' )
84
+ ) . rejects . toHaveProperty ( 'message' , expect . stringMatching ( 'Request failed with status code 401' ) )
100
85
} )
101
86
102
87
test ( 'Event broker mock event - messaging service ' , done => {
0 commit comments