Skip to content

Commit 7dbe334

Browse files
committed
fix: trival fixes
1 parent a18c83e commit 7dbe334

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

tests/anchor-cli-account/tests/account.ts

+7-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("Test CLI account commands", () => {
2323
await program.methods
2424
.initialize(
2525
balance,
26-
new anchor.BN(amount),
26+
amount,
2727
memo,
2828
values.map((x) => new anchor.BN(x))
2929
)
@@ -52,7 +52,11 @@ describe("Test CLI account commands", () => {
5252
}
5353
}
5454

55-
assert.strictEqual(output.balance, balance, "Balance deserialized incorrectly");
55+
assert.strictEqual(
56+
output.balance,
57+
balance,
58+
"Balance deserialized incorrectly"
59+
);
5660
assert.strictEqual(
5761
output.delegate_pubkey,
5862
provider.wallet.publicKey.toBase58(),
@@ -69,7 +73,7 @@ describe("Test CLI account commands", () => {
6973
"Memo deserialized incorrectly"
7074
);
7175
for (let i = 0; i < values.length; i++) {
72-
assert.strictEqual(
76+
assert.equal(
7377
output.sub.values[i],
7478
values[i],
7579
"Values deserialized incorrectly"

tests/cpi-returns/tests/cpi-return.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ describe("CPI return", () => {
2828

2929
const cpiReturn = anchor.web3.Keypair.generate();
3030

31-
const confirmOptions: ConfirmOptions = { commitment: "confirmed" };
31+
const confirmOptions: ConfirmOptions = {
32+
commitment: "confirmed",
33+
maxRetries: 5,
34+
};
3235

3336
it("can initialize", async () => {
3437
await calleeProgram.methods
@@ -45,7 +48,7 @@ describe("CPI return", () => {
4548
it("can return u64 from a cpi", async () => {
4649
const tx = await callerProgram.methods
4750
.cpiCallReturnU64()
48-
.accounts({
51+
.accountsPartial({
4952
cpiReturn: cpiReturn.publicKey,
5053
cpiReturnProgram: calleeProgram.programId,
5154
})
@@ -134,7 +137,7 @@ describe("CPI return", () => {
134137
});
135138

136139
const [key, data, buffer] = getReturnLog(t);
137-
assert.strictEqual(key, calleeProgram.programId);
140+
assert.strictEqual(key, calleeProgram.programId.toBase58());
138141

139142
// Check for matching log on receive side
140143
let receiveLog = t.meta.logMessages.find(

tests/misc/tests/misc/misc.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -740,7 +740,6 @@ const miscTest = (
740740
],
741741
});
742742
const account = await getAccount(connection, token.publicKey);
743-
// @ts-expect-error
744743
// assert.strictEqual(account.state, 1);
745744
assert.strictEqual(account.amount, BigInt(0));
746745
assert.isTrue(account.isInitialized);
@@ -781,7 +780,7 @@ const miscTest = (
781780

782781
const tx = await program.methods
783782
.testCompositePayer()
784-
.accounts({
783+
.accountsPartial({
785784
composite: {
786785
data: data1.publicKey,
787786
payer: provider.wallet.publicKey,
@@ -849,7 +848,7 @@ const miscTest = (
849848
);
850849
const ataAccount = AccountLayout.decode(rawAccount.data);
851850
assert.strictEqual(ataAccount.state, 1);
852-
assert.strictEqual(new anchor.BN(ataAccount.amount).toNumber(), 0);
851+
assert.strictEqual(ataAccount.amount, BigInt(0));
853852
assert.strictEqual(
854853
new PublicKey(ataAccount.owner).toString(),
855854
provider.wallet.publicKey.toString()
@@ -933,7 +932,7 @@ const miscTest = (
933932
);
934933
const ataAccount = AccountLayout.decode(rawAta.data);
935934
assert.strictEqual(ataAccount.state, 1);
936-
assert.strictEqual(new anchor.BN(ataAccount.amount).toNumber(), 0);
935+
assert.strictEqual(ataAccount.amount, BigInt(0));
937936
assert.strictEqual(
938937
new PublicKey(ataAccount.owner).toString(),
939938
provider.wallet.publicKey.toString()
@@ -1482,7 +1481,7 @@ const miscTest = (
14821481
newToken.publicKey
14831482
);
14841483
const ataAccount = AccountLayout.decode(rawAccount.data);
1485-
assert.strictEqual(new anchor.BN(ataAccount.amount).toNumber(), 0);
1484+
assert.strictEqual(ataAccount.amount, BigInt(0));
14861485
assert.strictEqual(
14871486
new PublicKey(ataAccount.mint).toString(),
14881487
newMint.publicKey.toString()
@@ -1581,7 +1580,7 @@ const miscTest = (
15811580
associatedToken
15821581
);
15831582
const ataAccount = AccountLayout.decode(rawAccount.data);
1584-
assert.strictEqual(new anchor.BN(ataAccount.amount).toNumber(), 0);
1583+
assert.strictEqual(ataAccount.amount, BigInt(0));
15851584
assert.strictEqual(
15861585
new PublicKey(ataAccount.mint).toString(),
15871586
newMint.publicKey.toString()

tests/realloc/tests/realloc.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe("realloc", () => {
2323
it("initialized", async () => {
2424
await program.methods
2525
.initialize()
26-
.accounts({ authority: authority.publicKey, sample })
26+
.accountsPartial({ authority: authority.publicKey, sample })
2727
.rpc();
2828

2929
const samples = await program.account.sample.all();
@@ -35,7 +35,7 @@ describe("realloc", () => {
3535
try {
3636
await program.methods
3737
.realloc(10250)
38-
.accounts({ authority: authority.publicKey, sample })
38+
.accountsPartial({ authority: authority.publicKey, sample })
3939
.rpc();
4040
assert.ok(false);
4141
} catch (e) {
@@ -51,7 +51,7 @@ describe("realloc", () => {
5151
it("realloc additive", async () => {
5252
await program.methods
5353
.realloc(5)
54-
.accounts({ authority: authority.publicKey, sample })
54+
.accountsPartial({ authority: authority.publicKey, sample })
5555
.rpc();
5656

5757
const s = await program.account.sample.fetch(sample);
@@ -61,7 +61,7 @@ describe("realloc", () => {
6161
it("realloc substractive", async () => {
6262
await program.methods
6363
.realloc(1)
64-
.accounts({ authority: authority.publicKey, sample })
64+
.accountsPartial({ authority: authority.publicKey, sample })
6565
.rpc();
6666

6767
const s = await program.account.sample.fetch(sample);
@@ -72,7 +72,7 @@ describe("realloc", () => {
7272
try {
7373
await program.methods
7474
.realloc2(1000)
75-
.accounts({
75+
.accountsPartial({
7676
authority: authority.publicKey,
7777
sample1: sample,
7878
sample2: sample,

0 commit comments

Comments
 (0)