Skip to content

Commit f6b9d79

Browse files
fixed biome issues
1 parent e37d07c commit f6b9d79

File tree

1 file changed

+11
-31
lines changed

1 file changed

+11
-31
lines changed

basics/counter/steel/tests/main.test.ts

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,18 @@
1-
import { describe, it } from 'mocha';
2-
import {
3-
Keypair,
4-
PublicKey,
5-
SystemProgram,
6-
Transaction,
7-
TransactionInstruction,
8-
} from '@solana/web3.js';
1+
import { Keypair, PublicKey, SystemProgram, Transaction, TransactionInstruction } from '@solana/web3.js';
2+
import * as borsh from 'borsh';
93
import { assert } from 'chai';
4+
import { describe, it } from 'mocha';
105
import { BanksClient, ProgramTestContext, start } from 'solana-bankrun';
11-
import * as borsh from 'borsh';
126

137
describe('counter program', async () => {
14-
const PROGRAM_ID = new PublicKey(
15-
'z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35',
16-
);
8+
const PROGRAM_ID = new PublicKey('z7msBPQHDJjTvdQRoEcKyENgXDhSRYeHieN1ZMTqo35');
179

1810
let context: ProgramTestContext;
1911
let client: BanksClient;
2012
let payer: Keypair;
2113

2214
before(async () => {
23-
context = await start(
24-
[{ name: 'counter_program', programId: PROGRAM_ID }],
25-
[],
26-
);
15+
context = await start([{ name: 'counter_program', programId: PROGRAM_ID }], []);
2716
client = context.banksClient;
2817
payer = context.payer;
2918
});
@@ -69,23 +58,20 @@ describe('counter program', async () => {
6958
};
7059

7160
// deserialize the counter account data
72-
const counterData = borsh.deserialize(counterSchema, accountInfo!.data) as {
61+
const counterData = borsh.deserialize(counterSchema, accountInfo?.data) as {
7362
value: bigint;
7463
};
7564

7665
// check the counter value is 0
77-
assert(counterData.value === BigInt(0), `counter value should be 0`);
66+
assert(counterData.value === BigInt(0), 'counter value should be 0');
7867

7968
// increment (must be a number between 0 and 255)
8069
const amount = BigInt(42);
8170
const amountBuffer = Buffer.alloc(8);
8271
amountBuffer.writeBigUInt64LE(amount);
8372

8473
// data for the increment instruction
85-
const incrementData = Buffer.concat([
86-
instructionDiscriminators.increment,
87-
amountBuffer,
88-
]);
74+
const incrementData = Buffer.concat([instructionDiscriminators.increment, amountBuffer]);
8975

9076
// create the increment instruction
9177
const incrementIx = new TransactionInstruction({
@@ -110,14 +96,8 @@ describe('counter program', async () => {
11096
assert(updatedAccountInfo !== null, 'counter account should exist');
11197

11298
// deserialize the updated counter account data
113-
const updatedCounterData = borsh.deserialize(
114-
counterSchema,
115-
updatedAccountInfo!.data,
116-
) as { value: bigint };
117-
118-
assert(
119-
updatedCounterData.value === BigInt(amount),
120-
`counter value should be ${amount} but we got ${updatedCounterData.value}`,
121-
);
99+
const updatedCounterData = borsh.deserialize(counterSchema, updatedAccountInfo?.data) as { value: bigint };
100+
101+
assert(updatedCounterData.value === BigInt(amount), `counter value should be ${amount} but we got ${updatedCounterData.value}`);
122102
});
123103
});

0 commit comments

Comments
 (0)