1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Purge assertRejects shim (#7794)

This commit is contained in:
Whymarrh Whitby 2020-01-10 10:57:45 -03:30 committed by GitHub
parent d349bd61d2
commit 4f5f671cb1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 20 deletions

View File

@ -1,7 +1,6 @@
import assert from 'assert' import assert from 'assert'
import ethUtil from 'ethereumjs-util' import ethUtil from 'ethereumjs-util'
import accountImporter from '../../../app/scripts/account-import-strategies/index' import accountImporter from '../../../app/scripts/account-import-strategies/index'
import { assertRejects } from '../test-utils'
describe('Account Import Strategies', function () { describe('Account Import Strategies', function () {
const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553' const privkey = '0x4cfd3e90fc78b0f86bf7524722150bb8da9c60cd532564d7ff43f5716514f553'
@ -14,25 +13,25 @@ describe('Account Import Strategies', function () {
}) })
it('throws an error for empty string private key', async () => { it('throws an error for empty string private key', async () => {
assertRejects(async function () { assert.rejects(async function () {
await accountImporter.importAccount('Private Key', [ '' ]) await accountImporter.importAccount('Private Key', [ '' ])
}, Error, 'no empty strings') }, Error, 'no empty strings')
}) })
it('throws an error for undefined string private key', async () => { it('throws an error for undefined string private key', async () => {
assertRejects(async function () { assert.rejects(async function () {
await accountImporter.importAccount('Private Key', [ undefined ]) await accountImporter.importAccount('Private Key', [ undefined ])
}) })
}) })
it('throws an error for undefined string private key', async () => { it('throws an error for undefined string private key', async () => {
assertRejects(async function () { assert.rejects(async function () {
await accountImporter.importAccount('Private Key', []) await accountImporter.importAccount('Private Key', [])
}) })
}) })
it('throws an error for invalid private key', async () => { it('throws an error for invalid private key', async () => {
assertRejects(async function () { assert.rejects(async function () {
await accountImporter.importAccount('Private Key', [ 'popcorn' ]) await accountImporter.importAccount('Private Key', [ 'popcorn' ])
}) })
}) })

View File

@ -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)
}
}