Created
February 24, 2022 23:51
-
-
Save merlox/d434302ffe72b25b5b0f025f5ec864f9 to your computer and use it in GitHub Desktop.
This is the second test for the Solana Rust program
This file contains hidden or 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
import { expect } from 'chai' // Keep this at the beginning of the file along with the other imports | |
it('Should write an article with 1 word successfully', 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', { | |
accounts: { | |
article: deployerKeypair.publicKey, | |
}, | |
signers: [], | |
}) | |
const articleData = await program.account.article.fetch(deployerKeypair.publicKey) | |
expect(articleData.content).to.equal('hey ') // 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