fix: adapt tests to higher default transaction signature fee (#531)
This commit is contained in:
@ -6,6 +6,7 @@ import {
|
||||
Loader,
|
||||
SystemProgram,
|
||||
sendAndConfirmTransaction,
|
||||
SOL_LAMPORTS,
|
||||
} from '../src';
|
||||
import {DEFAULT_TICKS_PER_SLOT, NUM_TICKS_PER_SECOND} from '../src/timing';
|
||||
import {mockRpc, mockRpcEnabled} from './__mocks__/node-fetch';
|
||||
@ -54,8 +55,8 @@ test('get program accounts', async () => {
|
||||
const account0 = new Account();
|
||||
const account1 = new Account();
|
||||
const programId = new Account();
|
||||
await connection.requestAirdrop(account0.publicKey, 42);
|
||||
await connection.requestAirdrop(account1.publicKey, 84);
|
||||
await connection.requestAirdrop(account0.publicKey, SOL_LAMPORTS);
|
||||
await connection.requestAirdrop(account1.publicKey, 0.5 * SOL_LAMPORTS);
|
||||
|
||||
let transaction = SystemProgram.assign(
|
||||
account0.publicKey,
|
||||
@ -79,9 +80,9 @@ test('get program accounts', async () => {
|
||||
account1.publicKey.toBase58(),
|
||||
]).toEqual(expect.arrayContaining([element[0]]));
|
||||
if (element[0] == account0.publicKey) {
|
||||
expect(element[1].lamports).toBe(42 - feeCalculator.lamportsPerSignature);
|
||||
expect(element[1].lamports).toBe(SOL_LAMPORTS - feeCalculator.lamportsPerSignature);
|
||||
} else {
|
||||
expect(element[1].lamports).toBe(84 - feeCalculator.lamportsPerSignature);
|
||||
expect(element[1].lamports).toBe(0.5 * SOL_LAMPORTS- feeCalculator.lamportsPerSignature);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -629,8 +630,8 @@ test('multi-instruction transaction', async () => {
|
||||
const accountTo = new Account();
|
||||
const connection = new Connection(url);
|
||||
|
||||
await connection.requestAirdrop(accountFrom.publicKey, 100000);
|
||||
expect(await connection.getBalance(accountFrom.publicKey)).toBe(100000);
|
||||
await connection.requestAirdrop(accountFrom.publicKey, SOL_LAMPORTS);
|
||||
expect(await connection.getBalance(accountFrom.publicKey)).toBe(SOL_LAMPORTS);
|
||||
|
||||
await connection.requestAirdrop(accountTo.publicKey, 21);
|
||||
expect(await connection.getBalance(accountTo.publicKey)).toBe(21);
|
||||
@ -663,11 +664,11 @@ test('multi-instruction transaction', async () => {
|
||||
Ok: null,
|
||||
});
|
||||
|
||||
// accountFrom may have less than 100000 due to transaction fees
|
||||
// accountFrom may have less than SOL_LAMPORTS due to transaction fees
|
||||
expect(await connection.getBalance(accountFrom.publicKey)).toBeGreaterThan(0);
|
||||
expect(
|
||||
await connection.getBalance(accountFrom.publicKey),
|
||||
).toBeLessThanOrEqual(100000);
|
||||
).toBeLessThanOrEqual(SOL_LAMPORTS);
|
||||
|
||||
expect(await connection.getBalance(accountTo.publicKey)).toBe(21);
|
||||
});
|
||||
@ -689,7 +690,7 @@ test('account change notification', async () => {
|
||||
mockCallback,
|
||||
);
|
||||
|
||||
await connection.requestAirdrop(owner.publicKey, 100000);
|
||||
await connection.requestAirdrop(owner.publicKey, SOL_LAMPORTS);
|
||||
await Loader.load(connection, owner, programAccount, BpfLoader.programId, [
|
||||
1,
|
||||
2,
|
||||
@ -743,7 +744,7 @@ test('program account change notification', async () => {
|
||||
},
|
||||
);
|
||||
|
||||
await connection.requestAirdrop(owner.publicKey, 100000);
|
||||
await connection.requestAirdrop(owner.publicKey, SOL_LAMPORTS);
|
||||
await Loader.load(connection, owner, programAccount, BpfLoader.programId, [
|
||||
1,
|
||||
2,
|
||||
|
Reference in New Issue
Block a user