any-of plugin test: bugfix for environments where AggregateError exists (ref. #8)

merge-requests/1/head
Michał 'rysiek' Woźniak 2021-08-29 20:12:04 +00:00
rodzic 6bf1887e7d
commit 4730361bad
1 zmienionych plików z 5 dodań i 1 usunięć

Wyświetl plik

@ -109,7 +109,11 @@ describe("plugin: any-of", () => {
try {
await self.LibResilientPlugins[0].fetch('https://resilient.is/test.json')
} catch (e) {
expect(e[0].toString()).toMatch('Error')
if (e instanceof Array) {
expect(e[0].toString()).toMatch('Error')
} else {
expect(e).toBeInstanceOf(AggregateError)
}
}
expect(fetch).toHaveBeenCalled();
});