@@ -10,10 +10,7 @@ import {
10
10
IAuthorizationError ,
11
11
IGenericNetworkError ,
12
12
} from "@fluidframework/driver-definitions/internal" ;
13
- import {
14
- type AuthorizationError ,
15
- NonRetryableError ,
16
- } from "@fluidframework/driver-utils/internal" ;
13
+ import { NonRetryableError } from "@fluidframework/driver-utils/internal" ;
17
14
import {
18
15
createOdspNetworkError ,
19
16
throwOdspNetworkError ,
@@ -272,19 +269,21 @@ describe("Odsp Error", () => {
272
269
throwOdspNetworkError ( errorMessage , 401 , testResponseWithInsufficientClaims ) ;
273
270
}
274
271
275
- it ( "Authorization error with insufficient claims first-class properties" , async ( ) => {
276
- try {
277
- throwAuthorizationErrorWithInsufficientClaims ( "TestMessage" ) ;
278
- } catch ( error : unknown ) {
279
- assert ( isIAuthorizationError ( error ) , "error should be a IAuthorizationError" ) ;
280
- assert ( error . message . includes ( "TestMessage" ) , "message should contain original message" ) ;
281
- assert . equal ( ( error as AuthorizationError ) . canRetry , false , "canRetry should be false" ) ;
282
- assert . equal (
283
- ( error as AuthorizationError ) . claims ,
284
- '{"access_token":{"nbf":{"essential":true, "value":"1597959090"}}}' ,
285
- "claims should be extracted from response" ,
286
- ) ;
287
- }
272
+ it ( "Authorization error with insufficient claims first-class properties" , ( ) => {
273
+ assert . throws (
274
+ ( ) => throwAuthorizationErrorWithInsufficientClaims ( "TestMessage" ) ,
275
+ ( error ) => {
276
+ assert ( isIAuthorizationError ( error ) , "error should be a IAuthorizationError" ) ;
277
+ assert . match ( error . message , / T e s t M e s s a g e / , "message should contain original message" ) ;
278
+ assert . equal ( error . canRetry , false , "canRetry should be false" ) ;
279
+ assert . equal (
280
+ error . claims ,
281
+ '{"access_token":{"nbf":{"essential":true, "value":"1597959090"}}}' ,
282
+ "claims should be extracted from response" ,
283
+ ) ;
284
+ return true ;
285
+ } ,
286
+ ) ;
288
287
} ) ;
289
288
290
289
it ( "Authorization error with insufficient claims results in retry with claims passed in options" , async ( ) => {
@@ -322,23 +321,21 @@ describe("Odsp Error", () => {
322
321
throwOdspNetworkError ( errorMessage , 401 , testResponseWithRealm ) ;
323
322
}
324
323
325
- it ( "Authorization error with realm first-class properties" , async ( ) => {
326
- try {
327
- throwAuthorizationErrorWithRealm ( "TestMessage" ) ;
328
- } catch ( error : unknown ) {
329
- assert ( isIAuthorizationError ( error ) , "error should be a IAuthorizationError" ) ;
330
- assert ( error . message . includes ( "TestMessage" ) , "message should contain original message" ) ;
331
- assert . strictEqual (
332
- ( error as AuthorizationError ) . canRetry ,
333
- false ,
334
- "canRetry should be false" ,
335
- ) ;
336
- assert . strictEqual (
337
- ( error as AuthorizationError ) . tenantId ,
338
- "6c482541-f706-4168-9e58-8e35a9992f58" ,
339
- "realm should be extracted from response" ,
340
- ) ;
341
- }
324
+ it ( "Authorization error with realm first-class properties" , ( ) => {
325
+ assert . throws (
326
+ ( ) => throwAuthorizationErrorWithRealm ( "TestMessage" ) ,
327
+ ( error ) => {
328
+ assert ( isIAuthorizationError ( error ) , "error should be a IAuthorizationError" ) ;
329
+ assert . match ( error . message , / T e s t M e s s a g e / , "message should contain original message" ) ;
330
+ assert . equal ( error . canRetry , false , "canRetry should be false" ) ;
331
+ assert . equal (
332
+ error . tenantId ,
333
+ "6c482541-f706-4168-9e58-8e35a9992f58" ,
334
+ "realm should be extracted from response" ,
335
+ ) ;
336
+ return true ;
337
+ } ,
338
+ ) ;
342
339
} ) ;
343
340
344
341
it ( "Authorization error with realm results in retry and realm passed as tenant id" , async ( ) => {
0 commit comments