Skip to content

Update todo-list-app.ts #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 21 additions & 17 deletions tests/todo-list-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,21 +119,25 @@ describe("todo-list-app", () => {
// assert.equal(taskAccount.isDone, true);
// });

// it("cannot create a task with more than 400 characters", async () => {
// const task = anchor.web3.Keypair.generate();
// try {
// await program.methods
// .addingTask("You are awesome".repeat(100))
// .accounts({
// task: task.publicKey,
// author: author.wallet.publicKey,
// systemProgram: anchor.web3.SystemProgram.programId,
// })
// .signers([task])
// .rpc();
// assert.fail("Expected an error");
// } catch (err) {
// assert.equal(err.toString(), "Error: failed to send transaction");
// }
// });
it("cannot create a task with more than 400 characters", async () => {
const task = anchor.web3.Keypair.generate();
try {
// Adjust the string length as needed
const longString = "You are awesome".repeat(25); // Adjust to find the right length
await program.methods
.addingTask(longString)
.accounts({
task: task.publicKey,
author: author.wallet.publicKey,
systemProgram: anchor.web3.SystemProgram.programId,
})
.signers([task])
.rpc();
assert.fail("Expected a TextTooLong error");
} catch (err) {
// Check for specific smart contract error
assert.include(err.toString(), "TextTooLong");
}
});

});