@@ -598,7 +598,7 @@ describe("OpenFGA Client", () => {
598
598
} ,
599
599
} ,
600
600
} ;
601
- const scope = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse , undefined , ConsistencyPreference . HigherConsistency ) ;
601
+ const scope = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse , undefined , ConsistencyPreference . HigherConsistency , "01GAHCE4YVKPQEKZQHT2R89MQV" ) ;
602
602
603
603
expect ( scope . isDone ( ) ) . toBe ( false ) ;
604
604
const response = await fgaClient . batchCheck ( {
@@ -661,8 +661,8 @@ describe("OpenFGA Client", () => {
661
661
} ,
662
662
} ;
663
663
664
- const scope0 = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse0 , undefined , ConsistencyPreference . HigherConsistency ) ;
665
- const scope1 = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse1 , undefined , ConsistencyPreference . HigherConsistency ) ;
664
+ const scope0 = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse0 , undefined , ConsistencyPreference . HigherConsistency , "01GAHCE4YVKPQEKZQHT2R89MQV" ) ;
665
+ const scope1 = nocks . singleBatchCheck ( baseConfig . storeId ! , mockedResponse1 , undefined , ConsistencyPreference . HigherConsistency , "01GAHCE4YVKPQEKZQHT2R89MQV" ) ;
666
666
667
667
expect ( scope0 . isDone ( ) ) . toBe ( false ) ;
668
668
expect ( scope1 . isDone ( ) ) . toBe ( false ) ;
@@ -730,6 +730,33 @@ describe("OpenFGA Client", () => {
730
730
expect ( resp2 ?. error ?. inputError ) . toBe ( ErrorCode . RelationNotFound ) ;
731
731
expect ( resp2 ?. error ?. message ) . toBe ( "relation not found" ) ;
732
732
} ) ;
733
+ // it("should throw an error if auth fails", async () => {
734
+ // const tuples = [{
735
+ // user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
736
+ // relation: "admin",
737
+ // object: "workspace:1",
738
+ // }];
739
+
740
+ // const scope0 = nocks.check(baseConfig.storeId!, tuples[0], defaultConfiguration.getBasePath(), {} as any,401);
741
+ // const scope1 = nock(defaultConfiguration.getBasePath())
742
+ // .get(`/stores/${defaultConfiguration.storeId!}/authorization-models`)
743
+ // .query({ page_size: 1 })
744
+ // .reply(401, {
745
+ // authorization_models: [],
746
+ // });
747
+ // try {
748
+ // await fgaClient.listRelations({
749
+ // user: "user:81684243-9356-4421-8fbf-a4f8d36aa31b",
750
+ // object: "workspace:1",
751
+ // relations: ["admin"],
752
+ // });
753
+ // } catch (err) {
754
+ // expect(err).toBeInstanceOf(FgaApiAuthenticationError);
755
+ // } finally {
756
+ // expect(scope0.isDone()).toBe(true);
757
+ // expect(scope1.isDone()).toBe(false);
758
+ // }
759
+ // });
733
760
} ) ;
734
761
735
762
describe ( "Expand" , ( ) => {
0 commit comments