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 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
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
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 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
import React from 'react'; | |
import sinon from 'sinon'; | |
import { shallow } from 'enzyme'; | |
import FilterBar from 'components/filter/FilterBar'; | |
const sampleFilters = { ids: [1, 2] }; | |
describe('Testing FilterBar', () => { | |
it('removeFilters removes filters as expected', () => { |
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 removeFilters remove filters as expected 1`] = ` | |
Array [ | |
Array [ | |
Object { | |
"ids": Array [ | |
2, | |
], | |
}, | |
], | |
Array [ |
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 React from 'react'; | |
import sinon from 'sinon'; | |
import { shallow } from 'enzyme'; | |
import FilterBar from 'components/filter/FilterBar'; | |
const sampleFilters = { ids: [1, 2] }; | |
describe('Testing FilterBar', () => { | |
it('removeFilters removes filters as expected', () => { |
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 React, { Component } from 'react'; | |
import _ from 'lodash'; | |
class FilterBar extends Component { | |
removeFilter = (filter) => { | |
const nextFilters = _.cloneDeep(this.props.filters); | |
nextFilters.ids.splice(nextFilters.ids.indexOf(filter.id), 1); | |
this.props.onFiltersChange(nextFilters); | |
} |
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 React from 'react'; | |
import { shallow } from 'enzyme'; | |
import mockStore from 'redux-mock-store'; | |
import sinon from 'sinon'; | |
import { NativeModules } from 'react-native'; | |
import CameraSettings from 'components/menu/CameraSettings'; | |
const initialState = { |