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
// __tests__/Login-page-test.js | |
import 'react-native'; | |
import React from 'react'; | |
import Login from 'components/sessions/login'; | |
import renderer from 'react-test-renderer'; | |
it('renders correctly', () => { | |
const tree = renderer.create( | |
<Login /> |
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 { ReassignLocationMenu } from 'components/menu/ReassignLocationMenu'; | |
describe('Testing ReassignLocationMenu component', () => { | |
it('renders as expected', () => { | |
const wrapper = shallow( | |
<ReassignLocationMenu count={2} /> | |
); | |
expect(wrapper).toMatchSnapshot(); |
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 configureStore from 'redux-mock-store'; | |
// imported as a connected component! | |
import CameraSettings from 'components/menu/CameraSettings'; | |
const middlewares = []; // you can mock any middlewares here if necessary | |
const mockStore = configureStore(middlewares); |
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
it('calls actions as expected when toggling switches', () => { | |
const wrapper = shallow( | |
<CameraSettings />, | |
{ context: { store: mockStore(initialState) } }, | |
); | |
const render = wrapper.dive(); | |
render.find('Switch').forEach(child => { | |
child.simulate('valueChange'); | |
}); | |
}); |
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'; | |
const initialState = { | |
preferences: { | |
save_photos_locally: true, |
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 = { |
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 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', () => { |
OlderNewer