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 mockStore from 'redux-mock-store'; | |
import { authenticateUser } from 'actions/sessions'; | |
import { LOGOUT } from 'constants/actions'; | |
import user from 'reducers/user'; | |
import { testUser } from 'jest/mock-objects'; | |
describe('Testing log in authentication', () => { | |
const store = mockStore(); | |
beforeEach(() => { |
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
exports[`Testing log in authentication attempt with correct password succeeds 1`] = ` | |
Array [ | |
Object { | |
"type": "LOGIN_STARTED", | |
}, | |
Object { | |
"type": "PROFILE_UPDATED", | |
"user": Object { ... }, | |
}, | |
Object { |
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]; |
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 mockStore from 'redux-mock-store'; | |
const store = mockStore(); | |
describe('Testing log in authentication', () => { | |
beforeEach(() => { | |
store.clearActions(); | |
}); | |
it('attempt with correct password succeeds', async () => { | |
await store.dispatch(authenticateUser('email@test.com', 'password')); |
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
jest.mock('Animated', () => { | |
return { | |
createTimer: jest.fn(), | |
timing: jest.fn(() => { | |
return { | |
start: jest.fn(), | |
}; | |
}), | |
Value: jest.fn(() => { | |
return { |
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'; | |
import mockStore from 'redux-mock-store'; | |
const mockApi = new MockAdapter(apiClient.getAxiosInstance()); | |
const validAuth = '{"email":"email@test.com","password":"password"}'; | |
const store = mockStore(); | |
mockApi.onPost('sessions').reply((config) => { |
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 { Dimensions } from 'react-native'; | |
const isTablet = Math.min( | |
Dimensions.get('window').width, | |
Dimensions.get('window').height) >= 768; | |
export { isTablet }; |
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
render() { | |
return( | |
<SettingsWrapper> | |
<SettingsHeader>Preferences</SettingsHeader> | |
... | |
</SettingsWrapper> | |
); | |
} |