Skip to content

Commit 2dd3e7a

Browse files
committed
chore: update TypeScript configuration and import path
* Change module setting in tsconfig.json from "commonjs" to "nodenext" for improved module resolution. * Update import statement in test.ts to include the file extension for Carnival type import.
1 parent acf5c1d commit 2dd3e7a

File tree

2 files changed

+58
-46
lines changed

2 files changed

+58
-46
lines changed
Lines changed: 50 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
1-
import * as anchor from '@coral-xyz/anchor';
2-
import type { Carnival } from '../target/types/carnival';
1+
import * as anchor from "@coral-xyz/anchor";
2+
import type { Carnival } from "../target/types/carnival.ts";
33

4-
describe('Carnival', () => {
5-
const provider = anchor.AnchorProvider.env();
6-
anchor.setProvider(provider);
7-
const wallet = provider.wallet as anchor.Wallet;
8-
const program = anchor.workspace.Carnival as anchor.Program<Carnival>;
4+
describe("Carnival", () => {
5+
const provider = anchor.AnchorProvider.env();
6+
anchor.setProvider(provider);
7+
const wallet = provider.wallet as anchor.Wallet;
8+
const program = anchor.workspace.Carnival as anchor.Program<Carnival>;
99

10-
async function sendCarnivalInstructions(instructionsList: anchor.web3.TransactionInstruction[]) {
11-
const tx = new anchor.web3.Transaction();
12-
for (const ix of instructionsList) {
13-
tx.add(ix);
14-
}
15-
await anchor.web3.sendAndConfirmTransaction(provider.connection, tx, [wallet.payer]);
16-
}
10+
async function sendCarnivalInstructions(
11+
instructionsList: anchor.web3.TransactionInstruction[],
12+
) {
13+
const tx = new anchor.web3.Transaction();
14+
for (const ix of instructionsList) {
15+
tx.add(ix);
16+
}
17+
await anchor.web3.sendAndConfirmTransaction(provider.connection, tx, [
18+
wallet.payer,
19+
]);
20+
}
1721

18-
it('Go on some rides!', async () => {
19-
await sendCarnivalInstructions([
20-
await program.methods.goOnRide('Jimmy', 36, 15, 'Scrambler').instruction(),
21-
await program.methods.goOnRide('Mary', 52, 1, 'Ferris Wheel').instruction(),
22-
await program.methods.goOnRide('Alice', 56, 15, 'Scrambler').instruction(),
23-
await program.methods.goOnRide('Bob', 49, 6, 'Tilt-a-Whirl').instruction(),
24-
]);
25-
});
22+
it("Go on some rides!", async () => {
23+
await sendCarnivalInstructions([
24+
await program.methods
25+
.goOnRide("Jimmy", 36, 15, "Scrambler")
26+
.instruction(),
27+
await program.methods
28+
.goOnRide("Mary", 52, 1, "Ferris Wheel")
29+
.instruction(),
30+
await program.methods
31+
.goOnRide("Alice", 56, 15, "Scrambler")
32+
.instruction(),
33+
await program.methods
34+
.goOnRide("Bob", 49, 6, "Tilt-a-Whirl")
35+
.instruction(),
36+
]);
37+
});
2638

27-
it('Play some games!', async () => {
28-
await sendCarnivalInstructions([
29-
await program.methods.playGame('Jimmy', 15, 'I Got It!').instruction(),
30-
await program.methods.playGame('Mary', 1, 'Ring Toss').instruction(),
31-
await program.methods.playGame('Alice', 15, 'Ladder Climb').instruction(),
32-
await program.methods.playGame('Bob', 6, 'Ring Toss').instruction(),
33-
]);
34-
});
39+
it("Play some games!", async () => {
40+
await sendCarnivalInstructions([
41+
await program.methods.playGame("Jimmy", 15, "I Got It!").instruction(),
42+
await program.methods.playGame("Mary", 1, "Ring Toss").instruction(),
43+
await program.methods.playGame("Alice", 15, "Ladder Climb").instruction(),
44+
await program.methods.playGame("Bob", 6, "Ring Toss").instruction(),
45+
]);
46+
});
3547

36-
it('Eat some food!', async () => {
37-
await sendCarnivalInstructions([
38-
await program.methods.eatFood('Jimmy', 15, 'Taco Shack').instruction(),
39-
await program.methods.eatFood('Mary', 1, "Larry's Pizza").instruction(),
40-
await program.methods.eatFood('Alice', 15, "Dough Boy's").instruction(),
41-
await program.methods.eatFood('Bob', 6, "Dough Boy's").instruction(),
42-
]);
43-
});
48+
it("Eat some food!", async () => {
49+
await sendCarnivalInstructions([
50+
await program.methods.eatFood("Jimmy", 15, "Taco Shack").instruction(),
51+
await program.methods.eatFood("Mary", 1, "Larry's Pizza").instruction(),
52+
await program.methods.eatFood("Alice", 15, "Dough Boy's").instruction(),
53+
await program.methods.eatFood("Bob", 6, "Dough Boy's").instruction(),
54+
]);
55+
});
4456
});
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
2-
"compilerOptions": {
3-
"types": ["mocha", "chai"],
4-
"typeRoots": ["./node_modules/@types"],
5-
"lib": ["es2015"],
6-
"module": "commonjs",
7-
"target": "es6",
8-
"esModuleInterop": true
9-
}
2+
"compilerOptions": {
3+
"types": ["mocha", "chai"],
4+
"typeRoots": ["./node_modules/@types"],
5+
"lib": ["es2015"],
6+
"module": "nodenext",
7+
"target": "es6",
8+
"esModuleInterop": true
9+
}
1010
}

0 commit comments

Comments
 (0)