From 4730361bad11c03a44ca5b77a93aff8743d620c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20=27rysiek=27=20Wo=C5=BAniak?= Date: Sun, 29 Aug 2021 20:12:04 +0000 Subject: [PATCH] any-of plugin test: bugfix for environments where AggregateError exists (ref. #8) --- __tests__/plugins/any-of.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/__tests__/plugins/any-of.test.js b/__tests__/plugins/any-of.test.js index e69419d..ac5650b 100644 --- a/__tests__/plugins/any-of.test.js +++ b/__tests__/plugins/any-of.test.js @@ -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(); });