Uninstalled jest-each and replaced by jest's native each

This commit is contained in:
Alejandro Celaya
2020-02-17 18:21:52 +01:00
parent da54a72b3e
commit d0f458bece
15 changed files with 30 additions and 45 deletions

View File

@@ -1,4 +1,3 @@
import each from 'jest-each';
import reducer, {
DELETE_SHORT_URL_ERROR,
DELETE_SHORT_URL_START,
@@ -60,9 +59,9 @@ describe('shortUrlDeletionReducer', () => {
getState.mockClear();
});
each(
it.each(
[[ undefined ], [ null ], [ 'example.com' ]]
).it('dispatches proper actions if API client request succeeds', async (domain) => {
)('dispatches proper actions if API client request succeeds', async (domain) => {
const apiClientMock = {
deleteShortUrl: jest.fn(() => ''),
};

View File

@@ -1,5 +1,4 @@
import moment from 'moment';
import each from 'jest-each';
import reducer, {
EDIT_SHORT_URL_META_START,
EDIT_SHORT_URL_META_ERROR,
@@ -57,7 +56,7 @@ describe('shortUrlMetaReducer', () => {
afterEach(jest.clearAllMocks);
each([[ undefined ], [ null ], [ 'example.com' ]]).it('dispatches metadata on success', async (domain) => {
it.each([[ undefined ], [ null ], [ 'example.com' ]])('dispatches metadata on success', async (domain) => {
await editShortUrlMeta(buildShlinkApiClient)(shortCode, domain, meta)(dispatch);
expect(buildShlinkApiClient).toHaveBeenCalledTimes(1);

View File

@@ -1,4 +1,3 @@
import each from 'jest-each';
import reducer, {
EDIT_SHORT_URL_TAGS_ERROR,
EDIT_SHORT_URL_TAGS_START,
@@ -61,7 +60,7 @@ describe('shortUrlTagsReducer', () => {
dispatch.mockReset();
});
each([[ undefined ], [ null ], [ 'example.com' ]]).it('dispatches normalized tags on success', async (domain) => {
it.each([[ undefined ], [ null ], [ 'example.com' ]])('dispatches normalized tags on success', async (domain) => {
const normalizedTags = [ 'bar', 'foo' ];
updateShortUrlTags.mockResolvedValue(normalizedTags);