tests: Add EscrowAccount type extraction and make package.json sufficient (#861)
This commit is contained in:
parent
58c00770cb
commit
eb65787a9e
|
@ -6,4 +6,4 @@ wallet = "~/.config/solana/id.json"
|
|||
escrow = "Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS"
|
||||
|
||||
[scripts]
|
||||
test = "ts-mocha -t 1000000 tests/*.ts"
|
||||
test = "yarn run ts-mocha -t 1000000 tests/*.ts"
|
||||
|
|
|
@ -4,10 +4,14 @@
|
|||
"@project-serum/serum": "latest",
|
||||
"@solana/spl-token": "latest",
|
||||
"@solana/web3.js": "latest",
|
||||
"@types/chai": "^4.2.22",
|
||||
"@types/mocha": "^9.0.0",
|
||||
"@types/node": "^14.14.37",
|
||||
"bn.js": "^5.2.0",
|
||||
"camelcase": "^6.2.0",
|
||||
"chai": "^4.3.4"
|
||||
"chai": "^4.3.4",
|
||||
"mocha": "^9.1.2",
|
||||
"ts-mocha": "^8.0.0",
|
||||
"typescript": "^4.4.3"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import * as anchor from "../../../ts";
|
||||
import { Program, BN } from "../../../ts";
|
||||
import { Program, BN, IdlAccounts } from "../../../ts";
|
||||
import {
|
||||
SYSVAR_RENT_PUBKEY,
|
||||
PublicKey,
|
||||
Keypair,
|
||||
SystemProgram,
|
||||
} from '@solana/web3.js';
|
||||
import { TOKEN_PROGRAM_ID, Token } from "@solana/spl-token";
|
||||
import { assert } from "chai";
|
||||
import { Escrow } from '../target/types/escrow';
|
||||
import { Escrow } from "../target/types/escrow";
|
||||
|
||||
type EscrowAccount = IdlAccounts<Escrow>["escrowAccount"];
|
||||
|
||||
describe("escrow", () => {
|
||||
const provider = anchor.Provider.env();
|
||||
|
@ -101,7 +102,6 @@ describe("escrow", () => {
|
|||
escrowAccount: escrowAccount.publicKey,
|
||||
systemProgram: SystemProgram.programId,
|
||||
tokenProgram: TOKEN_PROGRAM_ID,
|
||||
rent: SYSVAR_RENT_PUBKEY,
|
||||
},
|
||||
signers: [escrowAccount],
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ describe("escrow", () => {
|
|||
initializerTokenAccountA
|
||||
);
|
||||
|
||||
let _escrowAccount = await program.account.escrowAccount.fetch(
|
||||
let _escrowAccount: EscrowAccount = await program.account.escrowAccount.fetch(
|
||||
escrowAccount.publicKey
|
||||
);
|
||||
|
||||
|
@ -197,7 +197,6 @@ describe("escrow", () => {
|
|||
escrowAccount: newEscrow.publicKey,
|
||||
systemProgram: SystemProgram.programId,
|
||||
tokenProgram: TOKEN_PROGRAM_ID,
|
||||
rent: SYSVAR_RENT_PUBKEY,
|
||||
},
|
||||
signers: [newEscrow],
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue