Skip to content

Instantly share code, notes, and snippets.

@merlox
Created February 24, 2022 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save merlox/f5c4b19904644b1e5b2a36f8336777c1 to your computer and use it in GitHub Desktop.
Save merlox/f5c4b19904644b1e5b2a36f8336777c1 to your computer and use it in GitHub Desktop.
final test
it("should write 3 words two times", async () => {
const deployerKeypair = anchor.web3.Keypair.generate()
const personThatPays = program.provider.wallet
// Add your test here
await program.rpc.initialize({
accounts: {
article: deployerKeypair.publicKey,
personThatPays: personThatPays.publicKey,
systemProgram: anchor.web3.SystemProgram.programId,
},
signers: [deployerKeypair],
})
await program.rpc.writeIntoArticle('hey whats up', {
accounts: {
article: deployerKeypair.publicKey,
},
signers: [],
})
await program.rpc.writeIntoArticle('this is my', {
accounts: {
article: deployerKeypair.publicKey,
},
signers: [],
})
const articleData = await program.account.article.fetch(deployerKeypair.publicKey)
console.log('article data', articleData)
expect(articleData.content).to.equal('hey whats up this is my ') // Note the space at the end, added by the program
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment