diff --git a/domains/_discord.kuba.is-cool.dev.json b/domains/_discord.kuba.is-cool.dev.json deleted file mode 100644 index 91046af9..00000000 --- a/domains/_discord.kuba.is-cool.dev.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "domain": "is-cool.dev", - "subdomain": "_discord.kuba", - - "owner": { - "email": "pojg77g1@kbb.anonaddy.me" - }, - - "record": { - "TXT": ["dh=d1e32b265bbdaff2d41ffb2ab88b1f72b03ac45b"] - }, - - "proxied": false -} diff --git a/domains/_gh-openprofileproject-o.*.openprofile.is-cool.dev.json b/domains/_gh-openprofileproject-o.*.openprofile.is-cool.dev.json deleted file mode 100644 index 9c6886e7..00000000 --- a/domains/_gh-openprofileproject-o.*.openprofile.is-cool.dev.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "domain": "is-cool.dev", - "subdomain": "_gh-openprofileproject-o.*.openprofile", - - "owner": { - "repo": "https://github.com/openprofileproject/openprofileproject", - "email": "gamerselimiko@gmail.com" - }, - - "record": { - "TXT": ["457162e38b"] - }, - - "proxied": false -} diff --git a/domains/_gh-openprofileproject-o.openprofile.is-cool.dev.json b/domains/_gh-openprofileproject-o.openprofile.is-cool.dev.json deleted file mode 100644 index 9d933eba..00000000 --- a/domains/_gh-openprofileproject-o.openprofile.is-cool.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "github verification", - - "domain": "is-cool.dev", - "subdomain": "_gh-openprofileproject-o.openprofile", - - "owner": { - "repo": "https://github.com/openprofileproject", - "email": "us@openprofile.is-cool.dev" - }, - - "record": { - "TXT": ["8a7b386784"] - }, - - "proxied": false -} diff --git a/domains/_github-pages-challenge-aryaejoumalai.aryaejoumalai.is-a-fullstack.dev.json b/domains/_github-pages-challenge-aryaejoumalai.aryaejoumalai.is-a-fullstack.dev.json deleted file mode 100644 index f5e08824..00000000 --- a/domains/_github-pages-challenge-aryaejoumalai.aryaejoumalai.is-a-fullstack.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "GitHub Pages Verification aryaejoumalai", - - "domain": "is-a-fullstack.dev", - "subdomain": "_github-pages-challenge-AryaEjoumalai.aryaejoumalai", - - "owner": { - "repo": "https://github.com/AryaEjoumalai/portfolio", - "email": "aryaejoumalai@gmail.com" - }, - - "record": { - "TXT": ["41503457cf04f54c4a06a300513bd6"] - }, - - "proxied": false -} diff --git a/domains/_github-pages-challenge-arzejames.wacky.is-not-a.dev.json b/domains/_github-pages-challenge-arzejames.wacky.is-not-a.dev.json deleted file mode 100644 index 18e5e604..00000000 --- a/domains/_github-pages-challenge-arzejames.wacky.is-not-a.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "A website for a developer's profile", - - "domain": "is-not-a.dev", - "subdomain": "_github-pages-challenge-Arzejames.wacky", - - "owner": { - "repo": "https://github.com/Arzejames/WackyDevWebsite", - "email": "turtles127855@gmail.com" - }, - - "record": { - "TXT": ["5d4c72dcb4816fc1ff642af38784a2"] - }, - - "proxied": false -} diff --git a/domains/_github-pages-challenge-axviii3.axviii3.is-cool.dev.json b/domains/_github-pages-challenge-axviii3.axviii3.is-cool.dev.json deleted file mode 100644 index 1a0b3f5f..00000000 --- a/domains/_github-pages-challenge-axviii3.axviii3.is-cool.dev.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "For verifying my domain with github pages", - - "domain": "is-cool.dev", - "subdomain": "_github-pages-challenge-axviii3.axviii3", - - "owner": { - "repo": "https://github.com/AXVIII3/AXVIII3", - "email": "axviii3.yt@gmail.com" - }, - - "record": { - "TXT": ["3fa04e63a79eec99f8e37691d660e8"] - }, - - "proxied": false -} diff --git a/domains/_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft.is-local.org.json b/domains/_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft.is-local.org.json deleted file mode 100644 index ab2e5eed..00000000 --- a/domains/_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft.is-local.org.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "description": "Developer Profile", - - "domain": "is-local.org", - "subdomain": "_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft", - - "owner": { - "repo": "https://github.com/bhavesh-acquaintsoft/bhavesh-acquaintsoft.github.io", - "email": "bhavesh.kagathara@acquaintsofttech.com" - }, - - "record": { - "TXT": ["249109ee3609049a56a9a828e4c50f"] - }, - - "proxied": false -} diff --git a/tests/domains.test.js b/tests/domains.test.js index 4d817683..9d592f4f 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -5,7 +5,17 @@ const path = require("path"); const domainsPath = path.resolve("domains"); const files = fs.readdirSync(domainsPath); +/** + * Helper function to determine if a subdomain is a root domain. + * A root domain is assumed to be exactly two parts (e.g., "is-cool.dev"). + */ +function isRootDomain(domain) { + return domain.split(".").length === 2; +} + t("Nested subdomains should not exist without a parent subdomain", (t) => { + const issues = []; + files.forEach((file) => { // Skip directories and process only .json files const filePath = path.join(domainsPath, file); @@ -18,19 +28,26 @@ t("Nested subdomains should not exist without a parent subdomain", (t) => { if (subdomain.split(".").length > 2) { // Get parent domain by removing the leftmost part const parentSubdomain = subdomain.split(".").slice(1).join("."); - - // Ensure the parent subdomain exists - t.true( - files.includes(`${parentSubdomain}.json`), - `${file}: Parent subdomain ${parentSubdomain}.json does not exist` - ); + + // Skip check if the parent subdomain is a root domain + if (isRootDomain(parentSubdomain)) { + return; + } + + // Check if the parent subdomain exists + if (!files.includes(`${parentSubdomain}.json`)) { + issues.push(`${file}: Parent subdomain ${parentSubdomain}.json does not exist`); + } } }); - t.pass(); + // Report all issues at once + t.deepEqual(issues, [], `Found issues:\n${issues.join("\n")}`); }); t("Nested subdomains should not exist if the parent subdomain has NS records", (t) => { + const issues = []; + files.forEach((file) => { // Skip directories and process only .json files const filePath = path.join(domainsPath, file); @@ -45,22 +62,25 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", ( const parentSubdomain = subdomain.split(".").slice(1).join("."); const parentFilePath = path.join(domainsPath, `${parentSubdomain}.json`); + // Skip check if the parent subdomain is a root domain + if (isRootDomain(parentSubdomain)) { + return; + } + // Check if the parent file exists before attempting to read it if (fs.existsSync(parentFilePath)) { const parentDomain = fs.readJsonSync(parentFilePath); // Check if the parent has NS records - t.is( - parentDomain.record.NS, - undefined, - `${file}: Parent subdomain ${parentSubdomain} has NS records` - ); + if (parentDomain.record.NS !== undefined) { + issues.push(`${file}: Parent subdomain ${parentSubdomain} has NS records`); + } } else { - t.fail(`${parentSubdomain}.json file does not exist`); + issues.push(`${file}: Parent subdomain ${parentSubdomain}.json file does not exist`); } } }); - t.pass(); + // Report all issues at once + t.deepEqual(issues, [], `Found issues:\n${issues.join("\n")}`); }); -