test: add delegate mismatch test case

This commit is contained in:
Michael Vines
2018-10-10 10:42:00 -07:00
parent ad2fa3ceaf
commit d40712999c

View File

@ -448,9 +448,10 @@ test('invalid approve', async () => {
const owner = await newAccountWithTokens(connection); const owner = await newAccountWithTokens(connection);
const account1 = await testToken.newAccount(owner); const account1 = await testToken.newAccount(owner);
const account1Delegate = await testToken.newAccount(owner, account1);
const account2 = await testToken.newAccount(owner); const account2 = await testToken.newAccount(owner);
// account2 is not a delegate account // account2 is not a delegate account of account1
expect( expect(
testToken.approve( testToken.approve(
owner, owner,
@ -459,6 +460,16 @@ test('invalid approve', async () => {
123 123
) )
).rejects.toThrow(); ).rejects.toThrow();
// account1Delegate is not a delegate account of account2
expect(
testToken.approve(
owner,
account2,
account1Delegate,
123
)
).rejects.toThrow();
}); });