mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2025-05-05 19:22:58 +03:00
Removed remaining usages of sinon
This commit is contained in:
parent
f8de069567
commit
28ca54547e
24 changed files with 231 additions and 402 deletions
test/utils
|
@ -4,7 +4,6 @@ import { DropdownItem } from 'reactstrap';
|
|||
import { identity, values } from 'ramda';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faSortAmountDown as caretDownIcon } from '@fortawesome/free-solid-svg-icons';
|
||||
import * as sinon from 'sinon';
|
||||
import SortingDropdown from '../../src/utils/SortingDropdown';
|
||||
|
||||
describe('<SortingDropdown />', () => {
|
||||
|
@ -44,35 +43,35 @@ describe('<SortingDropdown />', () => {
|
|||
});
|
||||
|
||||
it('triggers change function when item is clicked and no order field was provided', () => {
|
||||
const onChange = sinon.spy();
|
||||
const onChange = jest.fn();
|
||||
const wrapper = createWrapper({ onChange });
|
||||
const firstItem = wrapper.find(DropdownItem).first();
|
||||
|
||||
firstItem.simulate('click');
|
||||
|
||||
expect(onChange.callCount).toEqual(1);
|
||||
expect(onChange.calledWith('foo', 'ASC')).toEqual(true);
|
||||
expect(onChange).toHaveBeenCalledTimes(1);
|
||||
expect(onChange).toHaveBeenCalledWith('foo', 'ASC');
|
||||
});
|
||||
|
||||
it('triggers change function when item is clicked and an order field was provided', () => {
|
||||
const onChange = sinon.spy();
|
||||
const onChange = jest.fn();
|
||||
const wrapper = createWrapper({ onChange, orderField: 'baz', orderDir: 'ASC' });
|
||||
const firstItem = wrapper.find(DropdownItem).first();
|
||||
|
||||
firstItem.simulate('click');
|
||||
|
||||
expect(onChange.callCount).toEqual(1);
|
||||
expect(onChange.calledWith('foo', 'ASC')).toEqual(true);
|
||||
expect(onChange).toHaveBeenCalledTimes(1);
|
||||
expect(onChange).toHaveBeenCalledWith('foo', 'ASC');
|
||||
});
|
||||
|
||||
it('updates order dir when already selected item is clicked', () => {
|
||||
const onChange = sinon.spy();
|
||||
const onChange = jest.fn();
|
||||
const wrapper = createWrapper({ onChange, orderField: 'foo', orderDir: 'ASC' });
|
||||
const firstItem = wrapper.find(DropdownItem).first();
|
||||
|
||||
firstItem.simulate('click');
|
||||
|
||||
expect(onChange.callCount).toEqual(1);
|
||||
expect(onChange.calledWith('foo', 'DESC')).toEqual(true);
|
||||
expect(onChange).toHaveBeenCalledTimes(1);
|
||||
expect(onChange).toHaveBeenCalledWith('foo', 'DESC');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue