chore: add integration test (#12143)

This commit is contained in:
Greg Fitzgerald 2020-09-09 17:32:50 -06:00 committed by GitHub
parent 4431080066
commit cd684577a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -441,4 +441,30 @@ test('live staking actions', async () => {
expect(balance).toEqual(minimumAmount + 2);
const recipientBalance = await connection.getBalance(recipient.publicKey);
expect(recipientBalance).toEqual(minimumAmount + 20);
// Authorize a derived address
authorize = StakeProgram.authorize({
stakePubkey: newAccountPubkey,
authorizedPubkey: newAuthorized.publicKey,
newAuthorizedPubkey: newAccountPubkey,
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,
});
await sendAndConfirmTransaction(connection, authorize, [newAuthorized], {
commitment: 'single',
skipPreflight: true,
});
// Restore the previous authority using a dervied address
authorize = StakeProgram.authorizeWithSeed({
stakePubkey: newAccountPubkey,
authorityBase: from.publicKey,
authoritySeed: seed,
authorityOwner: StakeProgram.programId,
newAuthorizedPubkey: newAuthorized.publicKey,
stakeAuthorizationType: StakeAuthorizationLayout.Withdrawer,
});
await sendAndConfirmTransaction(connection, authorize, [from], {
commitment: 'single',
skipPreflight: true,
});
});