This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export const doAuthenticate = async (data: doAuthenticateData) => { | |
| const options: AxiosRequestConfig = { | |
| method: 'POST', | |
| headers: { 'content-type': 'application/x-www-form-urlencoded' }, | |
| data: qs.stringify(data), | |
| url: API_URL_AUTH, | |
| withCredentials: false | |
| }; | |
| const response = await axios(options); | |
| return response; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import axios from 'axios'; | |
| import { doAuthenticate } from "../api" | |
| // temos que fazer o mock de library axios para simular uma request | |
| jest.mock('axios'); | |
| const mockAxios = axios as jest.MockedFunction<typeof axios>; | |
| describe('Api functions', () => { | |
| // verifique qual o valor de data que está chegando na função dologout e crie um objeto similar ao que temos abaixo dataMock |
OlderNewer