Skip to content

Commit

Permalink
close #34
Browse files Browse the repository at this point in the history
  • Loading branch information
zuies committed Jun 7, 2024
1 parent 9205f2a commit 28309f2
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
5 changes: 4 additions & 1 deletion contracts/Engagement.sol
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ contract EngagementContract is IEngagement, ERC1155, AccessControl {
string memory account
) external view override returns (string memory) {}

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

function supportsInterface(
bytes4 interfaceId
Expand Down
20 changes: 20 additions & 0 deletions test/engagements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,5 +309,25 @@ describe("Engage", function () {
});
});
});
describe("Update Scores", function () {
const date = BigInt(1625097600);
const cid = "SOME_RANDOM_CID";
describe("Revert", async function () {
it("Should revert with AccessControlUnauthorizedAccount (msg.sender doesn't have PROVIDER_ROLE)", async function () {
const { contract, otherAccount } = await loadFixture(deployFixture);
const PROVIDER_ROLE = await contract.read.PROVIDER_ROLE();

await expect(
contract.write.updateScores([date, cid], {
account: otherAccount.account.address,
})
).to.be.rejectedWith(
`AccessControlUnauthorizedAccount("${getAddress(
otherAccount.account.address
)}", "${PROVIDER_ROLE}")`
);
});
});
});
});
});

0 comments on commit 28309f2

Please sign in to comment.