11import fetchMock from "jest-fetch-mock" ;
2-
32import { ClientCredentials } from "simple-oauth2" ;
4- jest . mock ( "simple-oauth2" ) ;
53
64import {
75 BackendClient ,
@@ -687,29 +685,6 @@ describe("BackendClient", () => {
687685 let client : BackendClient ;
688686
689687 beforeEach ( ( ) => {
690- fetchMock . resetMocks ( ) ;
691- // These mocks are distinct from the ones in the outer beforeEach
692- // We need to test the behavior of the client when the OAuth token
693- // is expired or invalid
694- const expiredTokenMock = {
695- token : {
696- access_token : "expired-oauth-token" ,
697- } ,
698- expired : jest . fn ( ) . mockReturnValue ( true ) ,
699- } ;
700-
701- const newTokenMock = {
702- token : {
703- access_token : "new-oauth-token" ,
704- } ,
705- expired : jest . fn ( ) . mockReturnValue ( false ) ,
706- } ;
707-
708- const getTokenMock = jest
709- . fn ( )
710- . mockResolvedValueOnce ( expiredTokenMock )
711- . mockResolvedValueOnce ( newTokenMock ) ;
712-
713688 client = new BackendClient (
714689 {
715690 credentials : {
@@ -721,11 +696,6 @@ describe("BackendClient", () => {
721696 ) ;
722697 } ) ;
723698
724- afterEach ( ( ) => {
725- fetchMock . resetMocks ( ) ;
726- jest . clearAllMocks ( ) ;
727- } ) ;
728-
729699 it ( "should include externalUserId and environment headers" , async ( ) => {
730700 fetchMock . mockResponseOnce (
731701 JSON . stringify ( {
0 commit comments