Update pr.test.js

This commit is contained in:
William Harrison
2025-01-02 20:04:44 +08:00
parent 69eba1e0ad
commit d3c928e900
+8 -5
View File
@@ -43,21 +43,22 @@ t("Modified JSON files must be owned by the PR author", async (t) => {
);
})
);
t.pass();
});
t("New JSON files must be owned by the PR author", async (t) => {
if (EVENT !== "pull_request") {
t.pass();
return;
}
if (EVENT !== "pull_request") return t.pass();
const domainsFiles = await fs.readdir(domainsPath);
const headDomainsFiles = await fs.readdir(headDomainsPath).catch(() => []);
const headDomainsFiles = await fs.readdir(headDomainsPath);
const newFiles = domainsFiles.filter(
(file) => !headDomainsFiles.includes(file.substring(file.lastIndexOf("/") + 1))
);
console.log("New files", newFiles);
await Promise.all(
newFiles.map(async (file) => {
const domain = await getFileContent(domainsPath, file);
@@ -73,4 +74,6 @@ t("New JSON files must be owned by the PR author", async (t) => {
);
})
);
t.pass();
});