First replacements of sinon mocks with jest mocks

This commit is contained in:
Alejandro Celaya
2019-04-19 10:29:49 +02:00
parent 2cd6e52e9c
commit f8de069567
11 changed files with 666 additions and 127 deletions

View File

@@ -1,20 +1,18 @@
import React from 'react';
import { shallow } from 'enzyme';
import { identity } from 'ramda';
import sinon from 'sinon';
import createServerConstruct from '../../src/servers/CreateServer';
describe('<CreateServer />', () => {
let wrapper;
const ImportServersBtn = () => '';
const createServerMock = sinon.fake();
const createServerMock = jest.fn();
const historyMock = {
push: sinon.fake(),
push: jest.fn(),
};
beforeEach(() => {
createServerMock.resetHistory();
historyMock.push.resetHistory();
createServerMock.mockReset();
const CreateServer = createServerConstruct(ImportServersBtn);
@@ -44,8 +42,8 @@ describe('<CreateServer />', () => {
return '';
} });
expect(createServerMock.callCount).toEqual(1);
expect(historyMock.push.callCount).toEqual(1);
expect(createServerMock).toHaveBeenCalledTimes(1);
expect(historyMock.push).toHaveBeenCalledTimes(1);
});
it('updates state when inputs are changed', () => {