Fix remoteServers test

This commit is contained in:
Alejandro Celaya 2024-11-01 11:59:54 +01:00
parent e786f9d21f
commit 44fb07840e
2 changed files with 9 additions and 14 deletions

View file

@ -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);

View file

@ -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',