Fixed unhandled promise in remoteServers.test

This commit is contained in:
Alejandro Celaya
2021-10-31 12:20:02 +01:00
parent 80f0f9bd08
commit 57e73dcba6
2 changed files with 44 additions and 15 deletions

View File

@@ -13,7 +13,7 @@ describe('remoteServersReducer', () => {
it.each([
[
Promise.resolve({
{
data: [
{
id: '111',
@@ -28,7 +28,7 @@ describe('remoteServersReducer', () => {
apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a',
},
],
}),
},
{
111: {
id: '111',
@@ -44,8 +44,44 @@ describe('remoteServersReducer', () => {
},
},
],
[ Promise.resolve('<html></html>'), {}],
[ Promise.reject({}), {}],
[
{
data: [
{
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',
name: 'acel.me from servers.json',
url: 'https://acel.me',
apiKey: '07fb8a96-8059-4094-a24c-80a7d5e7e9b0',
},
333: {
id: '333',
name: 'Local from servers.json',
url: 'http://localhost:8000',
apiKey: '7a531c75-134e-4d5c-86e0-a71b7167b57a',
},
},
],
[ '<html></html>', {}],
[{}, {}],
])('tries to fetch servers from remote', async (mockedValue, expectedNewServers) => {
get.mockResolvedValue(mockedValue);