Skip to content

Commit fe037f9

Browse files
committed
anchor litesvm tests for Basics folder
1 parent bac8061 commit fe037f9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+8387
-5972
lines changed
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"dependencies": {
3-
"@coral-xyz/anchor": "^0.30.0",
4-
"@solana/web3.js": "^1.95.2"
3+
"@coral-xyz/anchor": "^0.31.1",
4+
"@solana/web3.js": "^1.98.2"
55
},
66
"devDependencies": {
7-
"anchor-bankrun": "^0.4.0",
8-
"solana-bankrun": "^0.3.0",
9-
"@types/bn.js": "^5.1.0",
10-
"@types/chai": "^4.3.0",
11-
"@types/mocha": "^9.0.0",
12-
"chai": "^4.3.4",
13-
"mocha": "^9.0.3",
14-
"ts-mocha": "^10.0.0",
15-
"typescript": "^4.3.5"
7+
"@types/bn.js": "^5.1.5",
8+
"@types/chai": "^5.2.2",
9+
"@types/mocha": "^10.0.10",
10+
"anchor-litesvm": "^0.1.2",
11+
"chai": "^5.2.0",
12+
"mocha": "^11.3.0",
13+
"ts-mocha": "^11.1.0",
14+
"ts-node": "^10.9.2",
15+
"tsconfig-paths": "^4.2.0",
16+
"typescript": "^5.8.3"
1617
}
1718
}

basics/account-data/anchor/pnpm-lock.yaml

Lines changed: 595 additions & 488 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

basics/account-data/anchor/tests/bankrun.test.ts renamed to basics/account-data/anchor/tests/litesvm.test.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
1-
import { describe, it } from 'node:test';
2-
import * as anchor from '@coral-xyz/anchor';
1+
import { Program } from '@coral-xyz/anchor';
32
import { Keypair } from '@solana/web3.js';
4-
import { PublicKey } from '@solana/web3.js';
5-
import { BankrunProvider } from 'anchor-bankrun';
6-
import { startAnchor } from 'solana-bankrun';
7-
import type { AnchorProgramExample } from '../target/types/anchor_program_example';
8-
3+
import { LiteSVMProvider, fromWorkspace } from 'anchor-litesvm';
4+
import { AnchorProgramExample } from '../target/types/anchor_program_example';
95
const IDL = require('../target/idl/anchor_program_example.json');
10-
const PROGRAM_ID = new PublicKey(IDL.address);
11-
12-
describe('Account Data!', async () => {
13-
const context = await startAnchor('', [{ name: 'anchor_program_example', programId: PROGRAM_ID }], []);
14-
const provider = new BankrunProvider(context);
156

16-
const payer = provider.wallet as anchor.Wallet;
17-
const program = new anchor.Program<AnchorProgramExample>(IDL, provider);
18-
19-
// Generate a new keypair for the addressInfo account
20-
const addressInfoAccount = new Keypair();
7+
describe('anchor', () => {
8+
let client: any;
9+
let provider: LiteSVMProvider;
10+
let program: Program<AnchorProgramExample>;
11+
let payer: Keypair;
12+
let addressInfoAccount: Keypair;
13+
14+
before(async () => {
15+
client = fromWorkspace('');
16+
provider = new LiteSVMProvider(client);
17+
payer = provider.wallet.payer;
18+
program = new Program<AnchorProgramExample>(IDL, provider);
19+
20+
// a keypair for the addressInfo account
21+
addressInfoAccount = new Keypair();
22+
});
2123

2224
it('Create the address info account', async () => {
2325
console.log(`Payer Address : ${payer.publicKey}`);
@@ -37,7 +39,7 @@ describe('Account Data!', async () => {
3739
addressInfo: addressInfoAccount.publicKey,
3840
payer: payer.publicKey,
3941
})
40-
.signers([addressInfoAccount])
42+
.signers([addressInfoAccount, payer])
4143
.rpc();
4244
});
4345

basics/account-data/anchor/tests/test.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
{
22
"dependencies": {
3-
"@coral-xyz/anchor": "^0.30.0",
4-
"@solana/web3.js": "^1.95.2"
3+
"@coral-xyz/anchor": "^0.31.1",
4+
"@solana/web3.js": "^1.98.2"
55
},
66
"devDependencies": {
7-
"anchor-bankrun": "^0.4.0",
8-
"solana-bankrun": "^0.3.0",
9-
"@types/bn.js": "^5.1.0",
10-
"@types/chai": "^4.3.0",
11-
"@types/mocha": "^9.0.0",
12-
"chai": "^4.3.4",
13-
"mocha": "^9.0.3",
14-
"ts-mocha": "^10.0.0",
15-
"typescript": "^4.3.5"
7+
"@types/bn.js": "^5.1.5",
8+
"@types/chai": "^5.2.2",
9+
"@types/mocha": "^10.0.10",
10+
"anchor-litesvm": "^0.1.2",
11+
"chai": "^5.2.0",
12+
"mocha": "^11.3.0",
13+
"ts-mocha": "^11.1.0",
14+
"ts-node": "^10.9.2",
15+
"tsconfig-paths": "^4.2.0",
16+
"typescript": "^5.8.3"
1617
}
1718
}

0 commit comments

Comments
 (0)