Created
February 24, 2022 23:59
-
-
Save merlox/f5c4b19904644b1e5b2a36f8336777c1 to your computer and use it in GitHub Desktop.
final test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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