Skip to content

Commit

Permalink
close #30
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Jun 6, 2024
1 parent 2071f30 commit 1e01d18
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
6 changes: 5 additions & 1 deletion contracts/Engagement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,11 @@ contract EngagementContract is IEngagement, ERC1155, AccessControl {
uint date,
uint id,
string memory account
) external view override returns (string memory) {}
) external view override returns (string memory) {
if (id >= _counter) {
revert NotFound(id);
}
}

function updateScores(uint date, string memory cid) external override {}

Expand Down
19 changes: 19 additions & 0 deletions test/engagements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -310,4 +310,23 @@ describe("Engage", function () {
});
});
});

describe("Get score", function () {
describe("Revert", async function () {
it("Should revert with NotFound (token doesn't exist)", async function () {
const { contract, otherAccount } = await loadFixture(deployFixture);
const date = BigInt(new Date().getTime());
const tokenId = parseUnits("999", 0);

await expect(
contract.read.getScores(
[date, tokenId, getAddress(otherAccount.account.address)],
{
account: otherAccount.account.address,
}
)
).to.be.rejectedWith("NotFound(999)");
});
});
});
});

0 comments on commit 1e01d18

Please sign in to comment.