feat: return null when account info not found

This commit is contained in:
Justin Starry
2020-04-05 16:18:45 +08:00
committed by Michael Vines
parent 0fcb1f6f56
commit 7989c10b7a
6 changed files with 57 additions and 40 deletions

View File

@ -224,7 +224,17 @@ test('live Nonce actions', async () => {
expect(nonceBalance).toEqual(minimumAmount);
const nonceQuery1 = await connection.getNonce(nonceAccount.publicKey);
if (nonceQuery1 === null) {
expect(nonceQuery1).not.toBeNull();
return;
}
const nonceQuery2 = await connection.getNonce(nonceAccount.publicKey);
if (nonceQuery2 === null) {
expect(nonceQuery2).not.toBeNull();
return;
}
expect(nonceQuery1.nonce).toEqual(nonceQuery2.nonce);
// Wait for blockhash to advance
@ -238,6 +248,10 @@ test('live Nonce actions', async () => {
);
await sendAndConfirmRecentTransaction(connection, advanceNonce, from);
const nonceQuery3 = await connection.getNonce(nonceAccount.publicKey);
if (nonceQuery3 === null) {
expect(nonceQuery3).not.toBeNull();
return;
}
expect(nonceQuery1.nonce).not.toEqual(nonceQuery3.nonce);
const nonce = nonceQuery3.nonce;