@@ -120,9 +120,9 @@ describe('workos-api', () => {
120120
121121 it ( 'throws WorkOSApiError on 401' , async ( ) => {
122122 mockFetch . mockResolvedValue ( mockResponse ( 401 , { message : 'Unauthorized' } , false ) ) ;
123- await expect (
124- workosRequest ( { method : 'GET' , path : '/organizations' , apiKey : 'bad_key' } ) ,
125- ) . rejects . toThrow ( WorkOSApiError ) ;
123+ await expect ( workosRequest ( { method : 'GET' , path : '/organizations' , apiKey : 'bad_key' } ) ) . rejects . toThrow (
124+ WorkOSApiError ,
125+ ) ;
126126 try {
127127 await workosRequest ( { method : 'GET' , path : '/organizations' , apiKey : 'bad_key' } ) ;
128128 } catch ( e ) {
@@ -132,14 +132,18 @@ describe('workos-api', () => {
132132
133133 it ( 'throws WorkOSApiError on 404' , async ( ) => {
134134 mockFetch . mockResolvedValue ( mockResponse ( 404 , { message : 'Not Found' } , false ) ) ;
135- await expect (
136- workosRequest ( { method : 'GET' , path : '/organizations/missing' , apiKey : 'sk_test' } ) ,
137- ) . rejects . toThrow ( WorkOSApiError ) ;
135+ await expect ( workosRequest ( { method : 'GET' , path : '/organizations/missing' , apiKey : 'sk_test' } ) ) . rejects . toThrow (
136+ WorkOSApiError ,
137+ ) ;
138138 } ) ;
139139
140140 it ( 'throws WorkOSApiError with validation errors on 422' , async ( ) => {
141141 mockFetch . mockResolvedValue (
142- mockResponse ( 422 , { message : 'Validation failed' , code : 'validation_error' , errors : [ { message : 'Name required' } ] } , false ) ,
142+ mockResponse (
143+ 422 ,
144+ { message : 'Validation failed' , code : 'validation_error' , errors : [ { message : 'Name required' } ] } ,
145+ false ,
146+ ) ,
143147 ) ;
144148 try {
145149 await workosRequest ( { method : 'POST' , path : '/organizations' , apiKey : 'sk_test' , body : { } } ) ;
@@ -153,9 +157,9 @@ describe('workos-api', () => {
153157
154158 it ( 'throws on network error' , async ( ) => {
155159 mockFetch . mockRejectedValue ( new TypeError ( 'fetch failed' ) ) ;
156- await expect (
157- workosRequest ( { method : 'GET' , path : '/organizations' , apiKey : 'sk_test' } ) ,
158- ) . rejects . toThrow ( 'Failed to connect to WorkOS API' ) ;
160+ await expect ( workosRequest ( { method : 'GET' , path : '/organizations' , apiKey : 'sk_test' } ) ) . rejects . toThrow (
161+ 'Failed to connect to WorkOS API' ,
162+ ) ;
159163 } ) ;
160164 } ) ;
161165} ) ;
0 commit comments