From 44fb07840e268b8efc734f211938371eb49cc71a Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Fri, 1 Nov 2024 11:59:54 +0100 Subject: [PATCH] Fix remoteServers test --- src/servers/helpers/index.ts | 2 +- test/servers/reducers/remoteServers.test.ts | 21 ++++++++------------- 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/src/servers/helpers/index.ts b/src/servers/helpers/index.ts index 6385c4d6..589b93c7 100644 --- a/src/servers/helpers/index.ts +++ b/src/servers/helpers/index.ts @@ -61,7 +61,7 @@ export function ensureUniqueIds(existingServers: ServersMap, serversList: Server iterations++; } - serversWithId.push({ id, ...server }); + serversWithId.push({ ...server, id }); // Add this server's ID to the list, so that it is taken into consideration for the next ones existingIds.add(id); diff --git a/test/servers/reducers/remoteServers.test.ts b/test/servers/reducers/remoteServers.test.ts index 1026cbcd..1fa8562a 100644 --- a/test/servers/reducers/remoteServers.test.ts +++ b/test/servers/reducers/remoteServers.test.ts @@ -12,27 +12,25 @@ describe('remoteServersReducer', () => { [ [ { - id: '111', name: 'acel.me from servers.json', url: 'https://acel.me', apiKey: '07fb8a96-8059-4094-a24c-80a7d5e7e9b0', }, { - id: '222', name: 'Local from servers.json', url: 'http://localhost:8000', apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, ], { - 111: { - id: '111', + 'acel.me-from-servers.json-acel.me': { + id: 'acel.me-from-servers.json-acel.me', name: 'acel.me from servers.json', url: 'https://acel.me', apiKey: '07fb8a96-8059-4094-a24c-80a7d5e7e9b0', }, - 222: { - id: '222', + 'local-from-servers.json-localhost-8000': { + id: 'local-from-servers.json-localhost-8000', name: 'Local from servers.json', url: 'http://localhost:8000', apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', @@ -42,31 +40,28 @@ describe('remoteServersReducer', () => { [ [ { - id: '111', name: 'acel.me from servers.json', url: 'https://acel.me', apiKey: '07fb8a96-8059-4094-a24c-80a7d5e7e9b0', }, { - id: '222', name: 'Invalid', }, { - id: '333', name: 'Local from servers.json', url: 'http://localhost:8000', apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a', }, ], { - 111: { - id: '111', + 'acel.me-from-servers.json-acel.me': { + id: 'acel.me-from-servers.json-acel.me', name: 'acel.me from servers.json', url: 'https://acel.me', apiKey: '07fb8a96-8059-4094-a24c-80a7d5e7e9b0', }, - 333: { - id: '333', + 'local-from-servers.json-localhost-8000': { + id: 'local-from-servers.json-localhost-8000', name: 'Local from servers.json', url: 'http://localhost:8000', apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a',