Skip to content

Commit

Permalink
test(contracts): fix eas_gatekeeper tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlc03 committed Mar 13, 2024
1 parent 877db94 commit 5bb933c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions contracts/tests/EASGatekeeper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,7 @@ describe("EAS Gatekeeper", () => {

it("sets MACI instance correctly", async () => {
const maciAddress = await maciContract.getAddress();
const tx = await easGatekeeper.setMaciInstance(maciAddress);
await tx.wait();
await easGatekeeper.setMaciInstance(maciAddress).then((tx) => tx.wait());

expect(await easGatekeeper.maci()).to.eq(maciAddress);
});
Expand All @@ -122,7 +121,7 @@ describe("EAS Gatekeeper", () => {
});

it("should throw when the attestation is not owned by the caller (mocking maci.signUp call)", async () => {
await easGatekeeper.setMaciInstance(signerAddress);
await easGatekeeper.setMaciInstance(signerAddress).then((tx) => tx.wait());

await expect(easGatekeeper.register(signerAddress, toBeArray(attestation))).to.be.revertedWithCustomError(
easGatekeeper,
Expand All @@ -138,15 +137,15 @@ describe("EAS Gatekeeper", () => {
});

it("should throw when the attestation schema is not the one expected by the gatekeeper", async () => {
await easGatekeeper.setMaciInstance(signerAddress);
await easGatekeeper.setMaciInstance(signerAddress).then((tx) => tx.wait());
await expect(easGatekeeper.register(signerAddress, toBeArray(wrongAttestation))).to.be.revertedWithCustomError(
easGatekeeper,
"InvalidSchema",
);
});

it("should throw when the attestation is not signed by the attestation owner", async () => {
await easGatekeeper.setMaciInstance(signerAddress);
await easGatekeeper.setMaciInstance(signerAddress).then((tx) => tx.wait());
await expect(
easGatekeeper.register(signerAddress, toBeArray(invalidAttesterAttestation)),
).to.be.revertedWithCustomError(easGatekeeper, "AttesterNotTrusted");
Expand All @@ -161,7 +160,7 @@ describe("EAS Gatekeeper", () => {

const userSigner = await ethers.getSigner(attestationOwner);

await easGatekeeper.setMaciInstance(await maciContract.getAddress());
await easGatekeeper.setMaciInstance(await maciContract.getAddress()).then((tx) => tx.wait());

// signup via MACI
const tx = await maciContract
Expand Down

0 comments on commit 5bb933c

Please sign in to comment.