Created
June 28, 2017 02:41
-
-
Save jasongaare/738c3172097d97f1d2e041f730db355a to your computer and use it in GitHub Desktop.
This file contains 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 MockAdapter from 'axios-mock-adapter'; | |
import apiClient from 'helpers/api-client'; | |
import { userObject } from 'jest/mockResponseObjects/user-objects'; | |
const mockApi = new MockAdapter(apiClient.getAxiosInstance()); | |
const validAuth = '{"email":"email@test.com","password":"password"}'; | |
mockApi.onPost('sessions').reply((config) => { | |
if (config.data === validAuth) { | |
return [200, userObject]; | |
} | |
return [400, 'Bad Credentials']; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment