docs: Fix tic-tac-toe example (#3115)

This commit is contained in:
Gabriel Castillo 2024-07-25 13:12:17 -07:00 committed by GitHub
parent c06ec446e2
commit fc765ff393
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 1428 additions and 906 deletions

View File

@ -0,0 +1,8 @@
{
"node-option": ["import=tsx"],
"extensions": ["ts"],
"timeout": 1000000,
"spec": [
"tests/**/*.ts"
]
}

View File

@ -6,4 +6,4 @@ cluster = "localnet"
wallet = "~/.config/solana/id.json"
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test = "yarn run mocha"

File diff suppressed because it is too large Load Diff

View File

@ -2,3 +2,6 @@
members = [
"programs/*"
]
[profile.release]
overflow-checks = true

View File

@ -1,14 +1,14 @@
{
"type": "module",
"dependencies": {
"@project-serum/anchor": "0.24.1"
"@coral-xyz/anchor": "^0.30.1"
},
"devDependencies": {
"@types/chai": "^4.3.0",
"@types/mocha": "^9.0.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"mocha": "9.2.2",
"ts-mocha": "^8.0.0",
"chai": "^5.1.1",
"mocha": "^10.7.0",
"tsx": "^4.16.2",
"typescript": "^4.3.5"
}
}

View File

@ -9,11 +9,12 @@ crate-type = ["cdylib", "lib"]
name = "tic_tac_toe"
[features]
default = []
cpi = ["no-entrypoint"]
no-entrypoint = []
no-idl = []
no-log-ix-name = []
cpi = ["no-entrypoint"]
default = []
idl-build = ["anchor-lang/idl-build"]
[dependencies]
anchor-lang = "=0.30.1"

View File

@ -1,10 +1,7 @@
import * as anchor from '@project-serum/anchor';
import { AnchorError, Program } from '@project-serum/anchor';
import * as anchor from "@coral-xyz/anchor";
import { AnchorError, type Program } from "@coral-xyz/anchor";
import { TicTacToe } from '../target/types/tic_tac_toe';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import { expect } from 'chai';
chai.use(chaiAsPromised);
async function play(program: Program<TicTacToe>, game, player, tile, expectedTurn, expectedGameState, expectedBoard) {
await program.methods

View File

@ -1,10 +1,11 @@
{
"compilerOptions": {
"types": ["mocha", "chai"],
"typeRoots": ["./node_modules/@types"],
"lib": ["es2015"],
"module": "commonjs",
"target": "es6",
"esModuleInterop": true
}
"lib": ["ESNext"],
"module": "ESNext",
"target": "ESNext",
"moduleResolution": "Node",
"esModuleInterop": true,
},
"include": ["**/*.ts"],
"exclude": ["node_modules"]
}

File diff suppressed because it is too large Load Diff