import { getAuthErrorMessage } from "." ; import { AxiosError } from "axios" ; describe ( "getAuthErrorMessage" , ( ) => { it ( "should return the message from the error" , ( ) => { const message = "Fake envalid credentials error" ; const error = { response : { data : { message } } } ; const actual = getAuthErrorMessage ( error as AxiosError ) ; expect ( actual ) . toEqual ( message ) ; } ) ; it ( "should return undefined if no error is present" , ( ) => { const error = { response : { } } ; const actual = getAuthErrorMessage ( error as AxiosError ) ; expect ( actual ) . toBeUndefined ( ) ; } ) ; } ) ;