Skip to content

Commit

Permalink
Merge pull request #28 from TogetherCrew/feat/close-25
Browse files Browse the repository at this point in the history
close #25
  • Loading branch information
cyri113 authored Jun 6, 2024
2 parents 749dcdf + b907461 commit 2071f30
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contracts/Engagement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ contract EngagementContract is IEngagement, ERC1155, AccessControl {
if (account != msg.sender) {
revert NotAllowed(account, tokenId);
}
if (tokenId >= _counter) {
revert NotFound(tokenId);
}
_burn(account, tokenId, 1);
emit Burn(account, tokenId, 1);
}
Expand Down
12 changes: 12 additions & 0 deletions test/engagements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,18 @@ describe("Engage", function () {
)}", ${tokenId})`
);
});
it("Should revert with NotFound (token doesn't exist)", async function () {
tokenId = parseUnits("999", 0);

await expect(
contract.write.burn(
[getAddress(otherAccount.account.address), tokenId, amount],
{
account: otherAccount.account.address,
}
)
).to.be.rejectedWith("NotFound(999)");
});
});
});
});
Expand Down

0 comments on commit 2071f30

Please sign in to comment.