Skip to content

Commit f58b095

Browse files
committed
add tests
1 parent c4545c3 commit f58b095

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

__tests__/configFile.test.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ test("checkSameOrgToolSpec same org", () => {
1414
tool3 = { source = "org1/tool3", version = "1.0.0" }\n
1515
`;
1616
let manifestContent = parse(config);
17-
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(
17+
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1", [])).toEqual(
1818
true
1919
);
2020
});
@@ -27,11 +27,36 @@ test("checkSameOrgToolSpec different org", () => {
2727
tool3 = { source = "org1/tool3", version = "1.0.0" }\n
2828
`;
2929
let manifestContent = parse(config);
30-
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1")).toEqual(
30+
expect(configFile.checkSameOrgToolSpecs(manifestContent, "org1", [])).toEqual(
3131
false
3232
);
3333
});
3434

35+
test("checkSameOrgToolSpec external org allowed with allowList", () => {
36+
let config = `
37+
[tools]\n
38+
tool1 = { source = "org1/tool1", version = "1.0.0" }\n
39+
tool2 = { source = "org2/tool2", version = "1.0.0" }\n
40+
tool3 = { source = "org1/tool3", version = "1.0.0" }\n
41+
`;
42+
let manifestContent = parse(config);
43+
expect(
44+
configFile.checkSameOrgToolSpecs(manifestContent, "org1", ["org2"])
45+
).toEqual(true);
46+
});
47+
48+
test("checkSameOrgToolSpec external org allowed case-insensitive", () => {
49+
let config = `
50+
[tools]\n
51+
tool1 = { source = "org1/tool1", version = "1.0.0" }\n
52+
tool2 = { source = "ORG2/tool2", version = "1.0.0" }\n
53+
`;
54+
let manifestContent = parse(config);
55+
expect(
56+
configFile.checkSameOrgToolSpecs(manifestContent, "org1", ["org2"])
57+
).toEqual(true);
58+
});
59+
3560
test("filter valid releases", () => {
3661
const releases: GitHubRelease[] = [
3762
{

0 commit comments

Comments
 (0)