Skip to content

Commit

Permalink
added combination of rule tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Bullrich committed Sep 5, 2023
1 parent 08fbfca commit 88dd33f
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/test/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ rules:
- name: Core developers
countAuthor: true
condition:
include:
include:
- .*
# excluding files from 'Runtime files' and 'CI files' rules
exclude:
exclude:
- ^polkadot/runtime/(kusama|polkadot)/src/[^/]+\.rs$
- ^cumulus/parachains/runtimes/assets/(asset-hub-kusama|asset-hub-polkadot)/src/[^/]+\.rs$
- ^cumulus/parachains/runtimes/bridge-hubs/(bridge-hub-kusama|bridge-hub-polkadot)/src/[^/]+\.rs$
Expand Down
27 changes: 27 additions & 0 deletions src/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,4 +226,31 @@ describe("Integration testing", () => {
console.log(report);
expect(report.missingReviews).toBe(2);
});

describe("Combinations", () => {
test("should use same reviewer for separate rules", async () => {
client.rest.pulls.listFiles.mockResolvedValue({
// @ts-ignore
data: [{ filename: "cumulus/parachains/common/src/example.rs" }, { filename: "README.md" }],
});
mockReviews([{ state: "approved", id: 123, login: "gavofyork" }]);
const newResult = await runner.runAction({ configLocation: "abc" });
console.log("nre result", JSON.stringify(newResult, null, 2));
expect(newResult.reports.map((r) => r.missingReviews).reduce((a, b) => a + b, 0)).toBe(3);
});

test("should use same reviewers for separate rules", async () => {
client.rest.pulls.listFiles.mockResolvedValue({
// @ts-ignore
data: [{ filename: "" }, { filename: "README.md" }],
});
mockReviews([
{ state: "approved", id: 123, login: "gavofyork" },
{ state: "approved", id: 124, login: "bkchr" },
]);
const result = await runner.runAction({ configLocation: "abc" });
console.log("nre result", JSON.stringify(result, null, 2));
expect(result.conclusion).toEqual("success");
});
});
});

0 comments on commit 88dd33f

Please sign in to comment.