import { authApi , client } from '@client/utils/authApi' ; import * as moxios from 'moxios' ; jest . unmock ( '@client/utils/authApi' ) ; describe ( 'authApi' , ( ) => { beforeEach ( ( ) => { moxios . install ( client ) ; } ) ; afterEach ( ( ) => { moxios . uninstall ( client ) ; } ) ; it ( 'invalidates a token' , async ( ) => { const expectedResponse = { } ; moxios . wait ( ( ) => { const request = moxios . requests . mostRecent ( ) ; request . respondWith ( { status : 200 , response : expectedResponse } ) ; } ) ; const result = await authApi . invalidateToken ( 'test' ) ; expect ( result ) . toEqual ( expectedResponse ) ; } ) ; } ) ;