Fakultas Ilmu Komputer UI

Commit f9e3542b authored by Hema Mitta Kalyani's avatar Hema Mitta Kalyani
Browse files

Merge branch '1606827706-200' into 'master'

1606827706 200

See merge request !233
parents b5f6da4c ab6804a7
Pipeline #26649 passed with stages
in 12 minutes and 56 seconds
......@@ -3,8 +3,14 @@ import React from 'react';
import ReactTestUtils from 'react-dom/test-utils';
import fetchMock from 'fetch-mock';
import VacancyList from '../../components/VacancyList';
import { shallow } from 'enzyme';
import { configure } from "enzyme";
import Adapter from "enzyme-adapter-react-16";
configure({ adapter: new Adapter() })
describe('VacancyList', () => {
let wrapper;
const companyUser = {
role: 'company',
data: {
......@@ -441,4 +447,32 @@ describe('VacancyList', () => {
done();
});
});
it('handle change salary filter', () => {
wrapper = shallow(<VacancyList items={newResponse} userId={3} user={supervisorUser} />);
const mockData = {
value: 2
};
wrapper.instance().handleChangeSalaryFilter(mockData);
expect(wrapper.state().salaryFilter).to.equal(2);
});
it('handle change vacancy state filter', () => {
wrapper = shallow(<VacancyList items={newResponse} userId={3} user={supervisorUser} />);
const mockData = {
value: 2
};
wrapper.instance().handleChangeVacancyStateFilter(mockData);
expect(wrapper.state().vacancyStateFilter).to.equal(2);
});
it('handle sort vacancy', () => {
wrapper = shallow(<VacancyList items={newResponse} userId={3} user={supervisorUser} />);
const mockData = {
value: 'NAME-ASC'
};
wrapper.instance().handleChangeSortVacancy(mockData);
expect(wrapper.state().sort).to.equal('NAME-ASC');
});
});
......@@ -139,15 +139,15 @@ export default class VacancyList extends React.Component {
}
};
handleChangeSalaryFilter = (e, data) => {
handleChangeSalaryFilter = (data) => {
this.setState({ salaryFilter: data.value });
};
handleChangeVacancyStateFilter = (e, data) => {
handleChangeVacancyStateFilter = (data) => {
this.setState({ vacancyStateFilter: data.value });
};
handleChangeSortVacancy = (e, data) => {
handleChangeSortVacancy = (data) => {
this.setState({ sort: data.value });
};
......
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment