i am trying to run a test for the flip of the bool value but getting this error while testing it
this is my code
it('Creates a Flipper', async () => {
const switchAccount = anchor.web3.Keypair.generate();
console.log(switchAccount.publicKey.toBase58())
await program.rpc.initialize({
accounts: {
switchAccount: switchAccount.publicKey,
user: provider.wallet.publicKey,
system_program: SystemProgram.programId,
},
signers: [switchAccount],
}); //Create RPC Closed
and this is the eroor i am getting
0 passing (11ms)
2 failing
1) light
Creates a Flipper:
TypeError: Cannot read properties of undefined (reading 'rpc')
at Context.<anonymous> (tests/light.js:16:19)
at processImmediate (node:internal/timers:466:21)
const anchor = require("@project-serum/anchor");
// provider is an abstraction of a connection to solana
const provider = anchor.Provider.local();
anchor.setProvider(provider);
const switchAccount = anchor.web3.Keypair.generate();
// initial letter must be capital letter
const program = anchor.workspace.Yourdappname;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.