From 37ac6cebc12475d0f7b25fb23c0d673bc9212071 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 31 Dec 2022 16:56:22 +0100 Subject: [PATCH] Fixed selectedServer reucer test --- test/servers/reducers/selectedServer.test.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/servers/reducers/selectedServer.test.ts b/test/servers/reducers/selectedServer.test.ts index a8db0c95..bbb93798 100644 --- a/test/servers/reducers/selectedServer.test.ts +++ b/test/servers/reducers/selectedServer.test.ts @@ -39,11 +39,12 @@ describe('selectedServerReducer', () => { }); describe('selectServer', () => { - const selectedServer = { - id: 'abc123', - }; const version = '1.19.0'; - const createGetStateMock = (id: string) => jest.fn().mockReturnValue({ servers: { [id]: selectedServer } }); + const createGetStateMock = (id: string) => jest.fn().mockReturnValue({ + servers: { + [id]: { id }, + }, + }); it.each([ [version, version, `v${version}`], @@ -53,7 +54,7 @@ describe('selectedServerReducer', () => { const id = uuid(); const getState = createGetStateMock(id); const expectedSelectedServer = { - ...selectedServer, + id, version: expectedVersion, printableVersion: expectedPrintableVersion, }; @@ -84,7 +85,7 @@ describe('selectedServerReducer', () => { it('dispatches error when health endpoint fails', async () => { const id = uuid(); const getState = createGetStateMock(id); - const expectedSelectedServer = Mock.of({ ...selectedServer, serverNotReachable: true }); + const expectedSelectedServer = Mock.of({ id, serverNotReachable: true }); health.mockRejectedValue({});