Skip to content

Commit

Permalink
Fix some frontend tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyyap committed Jan 15, 2018
1 parent e6e4488 commit b7709df
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,15 @@ exports[`<MaterialList /> renders the component with materials 1`] = `
<Material
deleting={false}
id={1}
key="1"
name="Material 1"
onMaterialDelete={[Function]}
updatedAt="2017-01-01T01:00:00.0000000Z"
/>
<Material
deleting={false}
id={2}
key="2"
name="Material 2"
onMaterialDelete={[Function]}
updatedAt="2017-01-01T02:00:00.0000000Z"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,11 @@ const scribingId = '3';

const mockFields = {
question_scribing: {
title: 'Scribing Exercise',
description: '',
maximum_grade: 10,
skill_ids: [],
staff_only_comments: '',
title: 'Scribing Exercise',
},
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,10 @@ describe('<ResponseForm />', () => {
textResponseAnswer = responseAnswers.at(0);
multipleChoiceAnswer = responseAnswers.at(1);
multipleResponseAnswer = responseAnswers.at(2);
}
};
updateResponse();

const lastMRQOptionCheckbox = multipleResponseAnswer.find('OptionsListItem').last().find('Checkbox');
let lastMRQOptionCheckbox = multipleResponseAnswer.find('OptionsListItem').last().find('Checkbox');
lastMRQOptionCheckbox.props().onCheck(null, true);

const submitButton = responseForm.find('button').last();
Expand Down Expand Up @@ -155,6 +155,7 @@ describe('<ResponseForm />', () => {
textResponse.simulate('change', { target: { value: newAnswer } });
const firstMCQOptionRadio = multipleChoiceAnswer.find('OptionsListItem').first().find('RadioButton');
firstMCQOptionRadio.props().onCheck(null, firstMCQOptionRadio.props().value);
lastMRQOptionCheckbox = multipleResponseAnswer.find('OptionsListItem').last().find('Checkbox');
lastMRQOptionCheckbox.props().onCheck(null, false);

submitButton.simulate('click');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-dom/test-utils';
import { mount } from 'enzyme';
import CourseAPI from 'api/course';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import PropTypes from 'prop-types';
import { mount } from 'enzyme';
import SingleFileInput from '../SingleFileInput';


describe('<SingleFileInput />', () => {
it('renders with url and name when provided in badge/avatar style', () => {
const singleFileInput = mount(
Expand All @@ -30,7 +29,6 @@ describe('<SingleFileInput />', () => {
);

const avatar = singleFileInput.find('Avatar').first();

expect(singleFileInput.find('.file-name').text().includes('bar')).toBeTruthy();
expect(avatar.prop('src')).toEqual('foo');
expect(avatar.prop('icon')).toBeUndefined();
Expand Down

0 comments on commit b7709df

Please sign in to comment.