From 4f5f671cb1f15646ed3b9e8673f49d918be01713 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Fri, 10 Jan 2020 10:57:45 -0330 Subject: [PATCH] Purge assertRejects shim (#7794) --- test/unit/app/account-import-strategies.spec.js | 9 ++++----- test/unit/test-utils.js | 15 --------------- 2 files changed, 4 insertions(+), 20 deletions(-) delete mode 100644 test/unit/test-utils.js diff --git a/test/unit/app/account-import-strategies.spec.js b/test/unit/app/account-import-strategies.spec.js index 8bfb571b8..ab7b0136d 100644 --- a/test/unit/app/account-import-strategies.spec.js +++ b/test/unit/app/account-import-strategies.spec.js @@ -1,7 +1,6 @@ import assert from 'assert' import ethUtil from 'ethereumjs-util' import accountImporter from '../../../app/scripts/account-import-strategies/index' -import { assertRejects } from '../test-utils' describe('Account Import Strategies', function () { const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553' @@ -14,25 +13,25 @@ describe('Account Import Strategies', function () { }) it('throws an error for empty string private key', async () => { - assertRejects(async function () { + assert.rejects(async function () { await accountImporter.importAccount('Private Key', [ '' ]) }, Error, 'no empty strings') }) it('throws an error for undefined string private key', async () => { - assertRejects(async function () { + assert.rejects(async function () { await accountImporter.importAccount('Private Key', [ undefined ]) }) }) it('throws an error for undefined string private key', async () => { - assertRejects(async function () { + assert.rejects(async function () { await accountImporter.importAccount('Private Key', []) }) }) it('throws an error for invalid private key', async () => { - assertRejects(async function () { + assert.rejects(async function () { await accountImporter.importAccount('Private Key', [ 'popcorn' ]) }) }) diff --git a/test/unit/test-utils.js b/test/unit/test-utils.js deleted file mode 100644 index 5cac52ff2..000000000 --- a/test/unit/test-utils.js +++ /dev/null @@ -1,15 +0,0 @@ -import assert from 'assert' - -// assert.rejects added in node v10 -export async function assertRejects (asyncFn, regExp) { - let f = () => {} - try { - await asyncFn() - } catch (error) { - f = () => { - throw error - } - } finally { - assert.throws(f, regExp) - } -}