Skip to content

Commit 98dc6f5

Browse files
committed
feat: enhance system account test with assertions and import updates
1 parent ff0e889 commit 98dc6f5

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

basics/rent/anchor/tests/test.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
import * as anchor from "@coral-xyz/anchor";
2+
import { assert } from "chai";
23
import Idl from "../target/idl/rent_example.json" with { type: "json" };
3-
import type { RentExample } from "../target/types/rent_example";
4+
import type { RentExample } from "../target/types/rent_example.ts";
45

5-
describe("Create a system account", () => {
6+
describe("Anchor: Create a system account", () => {
67
const provider = anchor.AnchorProvider.env();
78
anchor.setProvider(provider);
89
const wallet = provider.wallet as anchor.Wallet;
@@ -22,7 +23,6 @@ describe("Create a system account", () => {
2223
const addressDataBuffer = new anchor.BorshCoder(
2324
Idl as anchor.Idl,
2425
).types.encode("AddressData", addressData);
25-
console.log(`Address data buffer length: ${addressDataBuffer.length}`);
2626

2727
await program.methods
2828
.createSystemAccount(addressData)
@@ -32,5 +32,11 @@ describe("Create a system account", () => {
3232
})
3333
.signers([wallet.payer, newKeypair])
3434
.rpc();
35+
36+
const newKeypairInfo = await provider.connection.getAccountInfo(
37+
newKeypair.publicKey,
38+
);
39+
40+
assert.equal(newKeypairInfo.data.length, addressDataBuffer.length);
3541
});
3642
});

0 commit comments

Comments
 (0)