Skip to content

Commit 9606faa

Browse files
authored
Merge pull request #72 from oslabs-beta/bryan/testing
dropdown unit testing
2 parents ac730ac + 03d1c35 commit 9606faa

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

src/app/__tests__/MainContainer.test.js

Whitespace-only changes.

src/app/__tests__/actionContainer.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ configure({ adapter: new Adapter() });
1313
const state = {
1414
tabs: {
1515
87: {
16-
snapshots: [1,2,3,4],
16+
snapshots: [1, 2, 3, 4],
1717
sliderIndex: 0,
1818
viewIndex: -1,
1919
},

src/app/__tests__/dropdown.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,31 @@ configure({ adapter: new Adapter() });
99
describe('unit testing for Dropdown.jsx', () => {
1010
let wrapper;
1111
const props = {
12-
options: [
13-
{ value: 2000, label: '0.5x' },
14-
{ value: 1000, label: '1.0x' },
15-
{ value: 500, label: '2.0x' },
12+
speeds: [
13+
{ value: 1234, label: '0.5x' },
14+
{ value: 312, label: '1.0x' },
15+
{ value: 23, label: '2.0x' },
1616
],
17-
handleChangeSpeed: jest.fn(),
18-
selectedOption: { value: 1000, label: '1.0x' },
17+
setSpeed: jest.fn(),
18+
selectedOption: { value: 312, label: '1.0x' },
1919
};
2020
beforeEach(() => {
2121
wrapper = shallow(<Dropdown {...props} />);
2222
});
2323

2424
describe('Component', () => {
2525
test('array of objects that have value and label should be options props', () => {
26-
expect(wrapper.props().options).toEqual(props.options);
26+
expect(wrapper.props().options).toEqual(props.speeds);
2727
});
2828
test('selectedOption should be value property', () => {
29-
expect(wrapper.props().value).toEqual(props.selectedOption);
29+
expect(wrapper.props().value).toEqual(props.selectedSpeed);
3030
});
3131
});
3232

3333
describe('handlechangeSpeed', () => {
3434
test('should invoke handleChangeSpeed onChange', () => {
3535
wrapper.simulate('change', { value: 2000, label: '0.5x' });
36-
expect(props.handleChangeSpeed).toHaveBeenCalled();
36+
expect(props.setSpeed).toHaveBeenCalled();
3737
});
3838
});
3939
});

0 commit comments

Comments
 (0)