From 4cfb47e6c27ce09469416f292069ac45973a38c9 Mon Sep 17 00:00:00 2001 From: Clement Denis Date: Wed, 10 Mar 2021 03:46:30 +0100 Subject: [PATCH] fix for-each test --- js/tests/test.mjs | 9 +++++---- subjects/Dockerfile | 3 --- 2 files changed, 5 insertions(+), 7 deletions(-) delete mode 100644 subjects/Dockerfile diff --git a/js/tests/test.mjs b/js/tests/test.mjs index 4156101ea..de47a9767 100644 --- a/js/tests/test.mjs +++ b/js/tests/test.mjs @@ -29,10 +29,11 @@ const props = [String,Array] .filter(p => typeof p.value === 'function') const eq = (a, b) => { - const changed = props.filter(p => !p.src[p.key]) - changed.forEach(p => p.src[p.key] = p.value) + const changed = [] + for (const p of props) { !p.src[p.key] && (changed[changed.length] = p) } + for (const p of changed) { p.src[p.key] = p.value } deepStrictEqual(a, b) - changed.forEach(p => p.src[p.key] = undefined) + for (const p of changed) { p.src[p.key] = undefined } return true } @@ -62,7 +63,7 @@ const readTest = filename => })) const stackFmt = (err, url) => { - props.forEach(p => p.src[p.key] = p.value) + for (const p of props) { p.src[p.key] = p.value } if (err instanceof Error) return err.stack.split(url).join(`${name}.js`) throw Error(`Unexpected type thrown: ${typeof err}. usage: throw Error('my message')`) } diff --git a/subjects/Dockerfile b/subjects/Dockerfile deleted file mode 100644 index 1fdab83d9..000000000 --- a/subjects/Dockerfile +++ /dev/null @@ -1,3 +0,0 @@ -FROM scratch - -COPY . .