Update domains.test.js

This commit is contained in:
Jon authored and GitHub committed 2024-11-17 16:42:57 -05:00
1 parent 6fd20b1c7d
commit a9842fb109
1 file changed
+8 -3
+8 -3
View File
@@ -16,10 +16,13 @@ t("Nested subdomains should not exist without a parent subdomain", (t) => {
const subdomain = file.replace(".json", "");
if (subdomain.split(".").length > 1) {
const parentSubdomain = subdomain.split(".").pop();
// Get parent domain by removing the last part (subdomain) from the full subdomain
const parentSubdomain = subdomain.split(".").slice(1).join(".");
// Ensure the parent subdomain exists
t.true(
files.includes(`${parentSubdomain}.json`),
`${file}: Parent subdomain does not exist`
`${file}: Parent subdomain ${parentSubdomain}.json does not exist`
);
}
});
@@ -38,7 +41,9 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", (
const subdomain = file.replace(".json", "");
if (subdomain.split(".").length > 1) {
const parentSubdomain = subdomain.split(".").pop();
// Get parent domain by removing the last part (subdomain) from the full subdomain
const parentSubdomain = subdomain.split(".").slice(1).join(".");
const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`);
// Check if the parent file exists before attempting to read it