new pr tests + prettier

This commit is contained in:
William Harrison committed 2025-03-06 20:38:14 +08:00
1 parent 44e4f18142
commit 6339f26bef
8 files changed
+152 -252

No files matched your search

+9 -16
View File
@@ -25,29 +25,22 @@ function validateProxiedRecords(t, data, file) {
const recordTypes = Array.from(requiredRecordsToProxy).join(", ");
if (data.proxied) {
const hasProxiedRecord = Object.keys(data.record).some((key) =>
requiredRecordsToProxy.has(key),
);
const hasProxiedRecord = Object.keys(data.record).some((key) => requiredRecordsToProxy.has(key));
t.true(
hasProxiedRecord,
`${file}: Proxied is true but there are no records that can be proxied (${recordTypes} expected)`,
`${file}: Proxied is true but there are no records that can be proxied (${recordTypes} expected)`
);
}
}
const domainsPath = path.resolve("domains");
const files = fs
.readdirSync(domainsPath)
.filter((file) => file.endsWith(".json"));
const files = fs.readdirSync(domainsPath).filter((file) => file.endsWith(".json"));
t(
"Domains with proxy enabled must have at least one proxy-able record",
(t) => {
files.forEach((file) => {
const domain = getDomainData(file);
t("Domains with proxy enabled must have at least one proxy-able record", (t) => {
files.forEach((file) => {
const domain = getDomainData(file);
validateProxiedRecords(t, domain, file);
});
},
);
validateProxiedRecords(t, domain, file);
});
});