Skip to content

Commit

Permalink
Merge pull request #955 from privacy-scaling-explorations/fix/test-cli
Browse files Browse the repository at this point in the history
fix(test-cli): test fix
  • Loading branch information
ctrlc03 authored Jan 6, 2024
2 parents 610b4ac + bfecd5b commit 2c5e633
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 46 deletions.
66 changes: 39 additions & 27 deletions cli/tests/e2e.subsidy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,12 @@ describe("e2e with Subsidy tests", function test() {
);
});

it("should signup four users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup four users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish six messages", async () => {
Expand Down Expand Up @@ -315,10 +317,12 @@ describe("e2e with Subsidy tests", function test() {
);
});

it("should signup nine users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup nine users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish one message", async () => {
Expand Down Expand Up @@ -479,10 +483,12 @@ describe("e2e with Subsidy tests", function test() {
);
});

it("should signup four users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup four users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish four messages", async () => {
Expand Down Expand Up @@ -592,10 +598,12 @@ describe("e2e with Subsidy tests", function test() {
);
});

it("should signup five users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup five users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish five messages", async () => {
Expand Down Expand Up @@ -820,26 +828,29 @@ describe("e2e with Subsidy tests", function test() {
});

it("should signup an user", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < 6; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(publishArgs[i].pubkey);
}
});

it("should publish all messages", () => {
publishArgs.forEach(async (arg) => {
it("should publish all messages", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < publishArgs.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await publish(
arg.pubkey,
arg.stateIndex,
arg.voteOptionIndex,
arg.nonce,
arg.pollId,
arg.newVoteWeight,
publishArgs[i].pubkey,
publishArgs[i].stateIndex,
publishArgs[i].voteOptionIndex,
publishArgs[i].nonce,
publishArgs[i].pollId,
publishArgs[i].newVoteWeight,
maciAddresses.maciAddress,
genRandomSalt().toString(),
arg.privateKey,
publishArgs[i].privateKey,
);
});
}
});

it("should generate zk-SNARK proofs and verify them", async () => {
Expand Down Expand Up @@ -1039,7 +1050,8 @@ describe("e2e with Subsidy tests", function test() {
coordinatorPubKey,
);
// signup
for (let i = 0; i < 7; i += 1) {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
Expand Down
49 changes: 30 additions & 19 deletions cli/tests/e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,12 @@ describe("e2e tests", function test() {
);
});

it("should signup four users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup four users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish six messages", async () => {
Expand Down Expand Up @@ -327,10 +329,12 @@ describe("e2e tests", function test() {
);
});

it("should signup nine users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup nine users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish one message", async () => {
Expand Down Expand Up @@ -489,10 +493,12 @@ describe("e2e tests", function test() {
);
});

it("should signup four users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup four users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish four messages", async () => {
Expand Down Expand Up @@ -601,10 +607,12 @@ describe("e2e tests", function test() {
);
});

it("should signup five users", () => {
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
it("should signup five users", async () => {
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}
});

it("should publish five messages", async () => {
Expand Down Expand Up @@ -974,10 +982,13 @@ describe("e2e tests", function test() {
VOTE_OPTION_TREE_DEPTH,
coordinatorPubKey,
);

// signup
users.forEach(async (user) => {
await signup(user.pubKey.serialize());
});
// eslint-disable-next-line @typescript-eslint/prefer-for-of
for (let i = 0; i < users.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
await signup(users[i].pubKey.serialize());
}

// publish
await publish(
Expand Down

0 comments on commit 2c5e633

Please sign in to comment.