From d1c10e4895f66d587dc67bd1a3bece9d388a6e14 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 17 Mar 2019 10:17:44 +0100 Subject: [PATCH] Removed test cases for the old default on reducers switch statements --- test/servers/reducers/selectedServer.test.js | 3 --- test/servers/reducers/server.test.js | 3 --- test/short-urls/reducers/shortUrlCreation.test.js | 3 --- ...tUrlDeleteion.test.js => shortUrlDeletion.test.js} | 6 ------ test/short-urls/reducers/shortUrlsList.test.js | 6 ------ test/short-urls/reducers/shortUrlsListParams.test.js | 3 --- test/tags/reducers/tagDelete.test.js | 3 --- test/tags/reducers/tagEdit.test.js | 3 --- test/visits/reducers/shortUrlDetail.test.js | 11 ----------- test/visits/reducers/shortUrlVisits.test.js | 11 ----------- 10 files changed, 52 deletions(-) rename test/short-urls/reducers/{shortUrlDeleteion.test.js => shortUrlDeletion.test.js} (95%) diff --git a/test/servers/reducers/selectedServer.test.js b/test/servers/reducers/selectedServer.test.js index 2316e583..423637d6 100644 --- a/test/servers/reducers/selectedServer.test.js +++ b/test/servers/reducers/selectedServer.test.js @@ -9,9 +9,6 @@ import { RESET_SHORT_URL_PARAMS } from '../../../src/short-urls/reducers/shortUr describe('selectedServerReducer', () => { describe('reducer', () => { - it('returns default when action is not handled', () => - expect(reducer(null, { type: 'unknown' })).toEqual(null)); - it('returns default when action is RESET_SELECTED_SERVER', () => expect(reducer(null, { type: RESET_SELECTED_SERVER })).toEqual(null)); diff --git a/test/servers/reducers/server.test.js b/test/servers/reducers/server.test.js index 55844f0a..cbf81d00 100644 --- a/test/servers/reducers/server.test.js +++ b/test/servers/reducers/server.test.js @@ -24,9 +24,6 @@ describe('serverReducer', () => { describe('reducer', () => { it('returns servers when action is FETCH_SERVERS', () => expect(reducer({}, { type: FETCH_SERVERS, payload })).toEqual(payload)); - - it('returns default when action is unknown', () => - expect(reducer({}, { type: 'unknown' })).toEqual({})); }); describe('action creators', () => { diff --git a/test/short-urls/reducers/shortUrlCreation.test.js b/test/short-urls/reducers/shortUrlCreation.test.js index 371d257f..c9a4e0e3 100644 --- a/test/short-urls/reducers/shortUrlCreation.test.js +++ b/test/short-urls/reducers/shortUrlCreation.test.js @@ -39,9 +39,6 @@ describe('shortUrlCreationReducer', () => { error: false, }); }); - - it('returns provided state on unknown action', () => - expect(reducer({}, { type: 'unknown' })).toEqual({})); }); describe('resetCreateShortUrl', () => { diff --git a/test/short-urls/reducers/shortUrlDeleteion.test.js b/test/short-urls/reducers/shortUrlDeletion.test.js similarity index 95% rename from test/short-urls/reducers/shortUrlDeleteion.test.js rename to test/short-urls/reducers/shortUrlDeletion.test.js index 60aca8e7..b0289614 100644 --- a/test/short-urls/reducers/shortUrlDeleteion.test.js +++ b/test/short-urls/reducers/shortUrlDeletion.test.js @@ -45,12 +45,6 @@ describe('shortUrlDeletionReducer', () => { errorData, }); }); - - it('returns provided state as is on unknown action', () => { - const state = { foo: 'bar' }; - - expect(reducer(state, { type: 'unknown' })).toEqual(state); - }); }); describe('resetDeleteShortUrl', () => { diff --git a/test/short-urls/reducers/shortUrlsList.test.js b/test/short-urls/reducers/shortUrlsList.test.js index 08274afb..a3055a04 100644 --- a/test/short-urls/reducers/shortUrlsList.test.js +++ b/test/short-urls/reducers/shortUrlsList.test.js @@ -70,12 +70,6 @@ describe('shortUrlsListReducer', () => { }, }); }); - - it('returns provided state as is on unknown action', () => { - const state = { foo: 'bar' }; - - expect(reducer(state, { type: 'unknown' })).toEqual(state); - }); }); describe('listShortUrls', () => { diff --git a/test/short-urls/reducers/shortUrlsListParams.test.js b/test/short-urls/reducers/shortUrlsListParams.test.js index 334fdb71..5c032e95 100644 --- a/test/short-urls/reducers/shortUrlsListParams.test.js +++ b/test/short-urls/reducers/shortUrlsListParams.test.js @@ -8,9 +8,6 @@ describe('shortUrlsListParamsReducer', () => { describe('reducer', () => { const defaultState = { page: '1' }; - it('returns default value when action is unknown', () => - expect(reducer(defaultState, { type: 'unknown' })).toEqual(defaultState)); - it('returns params when action is LIST_SHORT_URLS', () => expect(reducer(defaultState, { type: LIST_SHORT_URLS, params: { searchTerm: 'foo' } })).toEqual({ ...defaultState, diff --git a/test/tags/reducers/tagDelete.test.js b/test/tags/reducers/tagDelete.test.js index b3cc8c8e..8915b14f 100644 --- a/test/tags/reducers/tagDelete.test.js +++ b/test/tags/reducers/tagDelete.test.js @@ -30,9 +30,6 @@ describe('tagDeleteReducer', () => { error: false, }); }); - - it('returns provided state on unknown action', () => - expect(reducer({}, { type: 'unknown' })).toEqual({})); }); describe('tagDeleted', () => { diff --git a/test/tags/reducers/tagEdit.test.js b/test/tags/reducers/tagEdit.test.js index 91642c06..14a63353 100644 --- a/test/tags/reducers/tagEdit.test.js +++ b/test/tags/reducers/tagEdit.test.js @@ -32,9 +32,6 @@ describe('tagEditReducer', () => { newName: 'bar', }); }); - - it('returns provided state on unknown action', () => - expect(reducer({}, { type: 'unknown' })).toEqual({})); }); describe('tagEdited', () => { diff --git a/test/visits/reducers/shortUrlDetail.test.js b/test/visits/reducers/shortUrlDetail.test.js index 2a5de1e1..218ca1c3 100644 --- a/test/visits/reducers/shortUrlDetail.test.js +++ b/test/visits/reducers/shortUrlDetail.test.js @@ -32,17 +32,6 @@ describe('shortUrlDetailReducer', () => { expect(error).toEqual(false); expect(shortUrl).toEqual(actionShortUrl); }); - - it('returns default state on unknown action', () => { - const defaultState = { - shortUrl: {}, - loading: false, - error: false, - }; - const state = reducer(defaultState, { type: 'unknown' }); - - expect(state).toEqual(defaultState); - }); }); describe('getShortUrlDetail', () => { diff --git a/test/visits/reducers/shortUrlVisits.test.js b/test/visits/reducers/shortUrlVisits.test.js index 97978609..0f714675 100644 --- a/test/visits/reducers/shortUrlVisits.test.js +++ b/test/visits/reducers/shortUrlVisits.test.js @@ -49,17 +49,6 @@ describe('shortUrlVisitsReducer', () => { expect(error).toEqual(false); expect(visits).toEqual(actionVisits); }); - - it('returns default state on unknown action', () => { - const defaultState = { - visits: [], - loading: false, - error: false, - }; - const state = reducer(defaultState, { type: 'unknown' }); - - expect(state).toEqual(defaultState); - }); }); describe('getShortUrlVisits', () => {