From 7a9209af0372edc523ad3013aa298a58f50b7ca4 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 1 Nov 2024 12:15:15 +0100 Subject: [PATCH] Use better names for remoteServers test datasets --- test/servers/reducers/remoteServers.test.ts | 31 +++++++++++++-------- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/test/servers/reducers/remoteServers.test.ts b/test/servers/reducers/remoteServers.test.ts index 1fa8562a..3c0cf580 100644 --- a/test/servers/reducers/remoteServers.test.ts +++ b/test/servers/reducers/remoteServers.test.ts @@ -9,8 +9,8 @@ describe('remoteServersReducer', () => { const httpClient = fromPartial({ jsonRequest }); it.each([ - [ - [ + { + serversArray: [ { name: 'acel.me from servers.json', url: 'https://acel.me', @@ -22,7 +22,7 @@ describe('remoteServersReducer', () => { apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, ], - { + expectedNewServers: { 'acel.me-from-servers.json-acel.me': { id: 'acel.me-from-servers.json-acel.me', name: 'acel.me from servers.json', @@ -36,9 +36,9 @@ describe('remoteServersReducer', () => { apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, }, - ], - [ - [ + }, + { + serversArray: [ { name: 'acel.me from servers.json', url: 'https://acel.me', @@ -53,7 +53,7 @@ describe('remoteServersReducer', () => { apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, ], - { + expectedNewServers: { 'acel.me-from-servers.json-acel.me': { id: 'acel.me-from-servers.json-acel.me', name: 'acel.me from servers.json', @@ -66,12 +66,19 @@ describe('remoteServersReducer', () => { url: 'http://localhost:8000', apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, + }, - ], - ['', {}], - [{}, {}], - ])('tries to fetch servers from remote', async (mockedValue, expectedNewServers) => { - jsonRequest.mockResolvedValue(mockedValue); + }, + { + serversArray: '', + expectedNewServers: {}, + }, + { + serversArray: {}, + expectedNewServers: {}, + }, + ])('tries to fetch servers from remote', async ({ serversArray, expectedNewServers }) => { + jsonRequest.mockResolvedValue(serversArray); const doFetchServers = fetchServers(httpClient); await doFetchServers()(dispatch, vi.fn(), {});