diff --git a/test/code.js b/test/code.js index 9ed09a9..dacca05 100644 --- a/test/code.js +++ b/test/code.js @@ -95,11 +95,11 @@ test('fails on no match', t => { }); test('returns country code for every country name in JSON', async t => { - const countries = (await import('../countries.json', {with: {type: 'json'}})).default; + const {default: countries} = await import('../countries.json', {with: {type: 'json'}}); - Object.values(countries).flat().forEach(name => { + for (const name of Object.values(countries).flat()) { t.not(code(name), undefined, `Should return code for name ${name}`); - }); + } }); // diff --git a/test/name.js b/test/name.js index 8a78684..c914304 100644 --- a/test/name.js +++ b/test/name.js @@ -68,11 +68,11 @@ test('returns undefined if non-alphabetic characters are given', t => { }); test('returns country name for every country code in JSON', async t => { - const countries = (await import('../countries.json', {with: {type: 'json'}})).default; + const {default: countries} = await import('../countries.json', {with: {type: 'json'}}); - Object.keys(countries).forEach(code => { + for (const code of Object.keys(countries)) { t.not(name(code), undefined, `Should return correct name for code ${code}`); - }); + } }); //