From ba3189fd46e54444af531af12b71e67a2ae0a7ba Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 19 Apr 2019 12:54:56 +0200 Subject: [PATCH] Removed no longer needed constants --- test/App.test.js | 3 +-- test/common/AsideMenu.test.js | 3 +-- test/tags/reducers/tagDelete.test.js | 6 ++---- test/tags/reducers/tagEdit.test.js | 3 +-- test/visits/ShortUrlVisits.test.js | 3 +-- 5 files changed, 6 insertions(+), 12 deletions(-) diff --git a/test/App.test.js b/test/App.test.js index c9df2d9c..428f3b1d 100644 --- a/test/App.test.js +++ b/test/App.test.js @@ -19,7 +19,6 @@ describe('', () => { it('renders app main routes', () => { const routes = wrapper.find(Route); - const expectedRoutesCount = 4; const expectedPaths = [ '/server/create', '/', @@ -27,7 +26,7 @@ describe('', () => { ]; expect.assertions(expectedPaths.length + 1); - expect(routes).toHaveLength(expectedRoutesCount); + expect(routes).toHaveLength(4); expectedPaths.forEach((path, index) => { expect(routes.at(index).prop('path')).toEqual(path); }); diff --git a/test/common/AsideMenu.test.js b/test/common/AsideMenu.test.js index 75500821..4541b00d 100644 --- a/test/common/AsideMenu.test.js +++ b/test/common/AsideMenu.test.js @@ -16,9 +16,8 @@ describe('', () => { it('contains links to different sections', () => { const links = wrapped.find(NavLink); - const expectedLength = 3; - expect(links).toHaveLength(expectedLength); + expect(links).toHaveLength(3); links.forEach((link) => expect(link.prop('to')).toContain('abc123')); }); diff --git a/test/tags/reducers/tagDelete.test.js b/test/tags/reducers/tagDelete.test.js index d12ec481..1978917a 100644 --- a/test/tags/reducers/tagDelete.test.js +++ b/test/tags/reducers/tagDelete.test.js @@ -49,7 +49,6 @@ describe('tagDeleteReducer', () => { afterEach(() => dispatch.mockReset()); it('calls API on success', async () => { - const expectedDispatchCalls = 2; const tag = 'foo'; const apiClientMock = createApiClientMock(Promise.resolve()); const dispatchable = deleteTag(() => apiClientMock)(tag); @@ -59,13 +58,12 @@ describe('tagDeleteReducer', () => { expect(apiClientMock.deleteTags).toHaveBeenCalledTimes(1); expect(apiClientMock.deleteTags).toHaveBeenNthCalledWith(1, [ tag ]); - expect(dispatch).toHaveBeenCalledTimes(expectedDispatchCalls); + expect(dispatch).toHaveBeenCalledTimes(2); expect(dispatch).toHaveBeenNthCalledWith(1, { type: DELETE_TAG_START }); expect(dispatch).toHaveBeenNthCalledWith(2, { type: DELETE_TAG }); }); it('throws on error', async () => { - const expectedDispatchCalls = 2; const error = 'Error'; const tag = 'foo'; const apiClientMock = createApiClientMock(Promise.reject(error)); @@ -80,7 +78,7 @@ describe('tagDeleteReducer', () => { expect(apiClientMock.deleteTags).toHaveBeenCalledTimes(1); expect(apiClientMock.deleteTags).toHaveBeenNthCalledWith(1, [ tag ]); - expect(dispatch).toHaveBeenCalledTimes(expectedDispatchCalls); + expect(dispatch).toHaveBeenCalledTimes(2); expect(dispatch).toHaveBeenNthCalledWith(1, { type: DELETE_TAG_START }); expect(dispatch).toHaveBeenNthCalledWith(2, { type: DELETE_TAG_ERROR }); }); diff --git a/test/tags/reducers/tagEdit.test.js b/test/tags/reducers/tagEdit.test.js index 035ced44..f70a3fa7 100644 --- a/test/tags/reducers/tagEdit.test.js +++ b/test/tags/reducers/tagEdit.test.js @@ -59,7 +59,6 @@ describe('tagEditReducer', () => { }); it('calls API on success', async () => { - const expectedDispatchCalls = 2; const oldName = 'foo'; const newName = 'bar'; const color = '#ff0000'; @@ -74,7 +73,7 @@ describe('tagEditReducer', () => { expect(colorGenerator.setColorForKey).toHaveBeenCalledTimes(1); expect(colorGenerator.setColorForKey).toHaveBeenCalledWith(newName, color); - expect(dispatch).toHaveBeenCalledTimes(expectedDispatchCalls); + expect(dispatch).toHaveBeenCalledTimes(2); expect(dispatch).toHaveBeenNthCalledWith(1, { type: EDIT_TAG_START }); expect(dispatch).toHaveBeenNthCalledWith(2, { type: EDIT_TAG, oldName, newName }); }); diff --git a/test/visits/ShortUrlVisits.test.js b/test/visits/ShortUrlVisits.test.js index 82930585..e7006c75 100644 --- a/test/visits/ShortUrlVisits.test.js +++ b/test/visits/ShortUrlVisits.test.js @@ -76,9 +76,8 @@ describe('', () => { const wrapper = createComponent({ loading: false, error: false, visits: [{}, {}, {}] }); const graphs = wrapper.find(GraphCard); const sortableBarGraphs = wrapper.find(SortableBarGraph); - const expectedGraphsCount = 5; - expect(graphs.length + sortableBarGraphs.length).toEqual(expectedGraphsCount); + expect(graphs.length + sortableBarGraphs.length).toEqual(5); }); it('reloads visits when selected dates change', () => {