Fix all tests and replace enzyme with @testing-library/react

This commit is contained in:
SleepWalker
2020-05-21 21:08:47 +03:00
parent a0ec9574e2
commit e1f15b5d22
20 changed files with 430 additions and 600 deletions

View File

@@ -4,7 +4,9 @@ import request from 'app/services/request';
import options from './options';
describe('services/api/options', () => {
const expectedResp = { foo: 'bar' };
const expectedResp = {
foo: 'bar',
};
beforeEach(() => {
sinon
@@ -24,7 +26,10 @@ describe('services/api/options', () => {
it('should request options without token', () =>
options.get().then((resp) => {
expect(resp, 'to be', expectedResp);
expect(resp, 'to satisfy', {
...expectedResp,
originalResponse: expect.it('to be a', Response),
});
expect(request.get, 'to have a call satisfying', [
'/api/options',
{},
@@ -36,7 +41,10 @@ describe('services/api/options', () => {
// NOTE: this is bad practice, but we are relying on the state from
// the previous test
options.get().then((resp) => {
expect(resp, 'to be', expectedResp);
expect(resp, 'to satisfy', {
...expectedResp,
originalResponse: expect.it('to be a', Response),
});
expect(request.get, 'was not called');
}));
});