@ -389,26 +389,26 @@ describe('permissions controller', function () {
it ( 'throws error on non-array accounts' , async function ( ) {
await assert . reject s(
permController . validatePermittedAccounts ( undefined ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( undefined ) ,
ERRORS . validatePermittedAccounts . invalidParam ( ) ,
'should throw on undefined'
)
await assert . reject s(
permController . validatePermittedAccounts ( false ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( false ) ,
ERRORS . validatePermittedAccounts . invalidParam ( ) ,
'should throw on false'
)
await assert . reject s(
permController . validatePermittedAccounts ( true ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( true ) ,
ERRORS . validatePermittedAccounts . invalidParam ( ) ,
'should throw on true'
)
await assert . reject s(
permController . validatePermittedAccounts ( { } ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( { } ) ,
ERRORS . validatePermittedAccounts . invalidParam ( ) ,
'should throw on non-array object'
)
@ -416,8 +416,8 @@ describe('permissions controller', function () {
it ( 'throws error on empty array of accounts' , async function ( ) {
await assert . reject s(
permController . validatePermittedAccounts ( [ ] ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( [ ] ) ,
ERRORS . validatePermittedAccounts . invalidParam ( ) ,
'should throw on empty array'
)
@ -427,14 +427,14 @@ describe('permissions controller', function () {
const keyringAccounts = await permController . getKeyringAccounts ( )
await assert . reject s(
permController . validatePermittedAccounts ( [ DUMMY _ACCOUNT ] ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( [ DUMMY _ACCOUNT ] ) ,
ERRORS . validatePermittedAccounts . nonKeyringAccount ( DUMMY _ACCOUNT ) ,
'should throw on non-keyring account'
)
await assert . reject s(
permController . validatePermittedAccounts ( keyringAccounts . concat ( DUMMY _ACCOUNT ) ) ,
await assert . throw s(
( ) => permController . validatePermittedAccounts ( keyringAccounts . concat ( DUMMY _ACCOUNT ) ) ,
ERRORS . validatePermittedAccounts . nonKeyringAccount ( DUMMY _ACCOUNT ) ,
'should throw on non-keyring account with other accounts'
)
@ -444,18 +444,18 @@ describe('permissions controller', function () {
const keyringAccounts = await permController . getKeyringAccounts ( )
await assert . doesNotReject (
permController . validatePermittedAccounts ( keyringAccounts ) ,
await assert . doesNotThrow (
( ) => permController . validatePermittedAccounts ( keyringAccounts ) ,
'should not throw on all keyring accounts'
)
await assert . doesNotReject (
permController . validatePermittedAccounts ( [ keyringAccounts [ 0 ] ] ) ,
await assert . doesNotThrow (
( ) => permController . validatePermittedAccounts ( [ keyringAccounts [ 0 ] ] ) ,
'should not throw on single keyring account'
)
await assert . doesNotReject (
permController . validatePermittedAccounts ( [ keyringAccounts [ 1 ] ] ) ,
await assert . doesNotThrow (
( ) => permController . validatePermittedAccounts ( [ keyringAccounts [ 1 ] ] ) ,
'should not throw on single keyring account'
)
} )