Skip to content
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

test(contracts): fix eas_gatekeeper tests #1296

Merged
merged 1 commit into from
Mar 13, 2024
Merged
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
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
Loading