From 6649c27f219329b5095e6acf2253d15b5204c751 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:44:46 -0500 Subject: [PATCH 1/9] Update domains.test.js --- tests/domains.test.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 4d817683..0fa7a47f 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -5,6 +5,14 @@ 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) => { files.forEach((file) => { // Skip directories and process only .json files @@ -19,6 +27,11 @@ t("Nested subdomains should not exist without a parent subdomain", (t) => { // Get parent domain by removing the leftmost part const parentSubdomain = subdomain.split(".").slice(1).join("."); + // Skip check if the parent subdomain is a root domain + if (isRootDomain(parentSubdomain)) { + return; + } + // Ensure the parent subdomain exists t.true( files.includes(`${parentSubdomain}.json`), @@ -45,6 +58,11 @@ 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); @@ -63,4 +81,3 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", ( t.pass(); }); - From 1c16431d83c42db4dd9c4ab5c5ccdce479bf3549 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:45:36 -0500 Subject: [PATCH 2/9] Delete domains/_discord.kuba.is-cool.dev.json --- domains/_discord.kuba.is-cool.dev.json | 14 -------------- 1 file changed, 14 deletions(-) delete mode 100644 domains/_discord.kuba.is-cool.dev.json 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 -} From 4bcb0c10df554a7b4ab40cb754d4b70621e95132 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:48:14 -0500 Subject: [PATCH 3/9] Delete domains/_gh-openprofileproject-o.*.openprofile.is-cool.dev.json --- ...rofileproject-o.*.openprofile.is-cool.dev.json | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 domains/_gh-openprofileproject-o.*.openprofile.is-cool.dev.json 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 -} From 0edee5ce1420db8635b847d5162400c700b7e519 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:48:22 -0500 Subject: [PATCH 4/9] Delete domains/_gh-openprofileproject-o.openprofile.is-cool.dev.json --- ...rofileproject-o.openprofile.is-cool.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_gh-openprofileproject-o.openprofile.is-cool.dev.json 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 -} From 14640c8644bd6a1e9dfd3733533629593a074bd9 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:49:09 -0500 Subject: [PATCH 5/9] Delete domains/_github-pages-challenge-aryaejoumalai.aryaejoumalai.is-a-fullstack.dev.json --- ...umalai.aryaejoumalai.is-a-fullstack.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_github-pages-challenge-aryaejoumalai.aryaejoumalai.is-a-fullstack.dev.json 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 -} From 616045c9d8733ec498c504ba82f7853e1814705e Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:49:52 -0500 Subject: [PATCH 6/9] Delete domains/_github-pages-challenge-arzejames.wacky.is-not-a.dev.json --- ...-challenge-arzejames.wacky.is-not-a.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_github-pages-challenge-arzejames.wacky.is-not-a.dev.json 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 -} From 58c9398b8c52949166868f75ce8b5015f11b1541 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:50:26 -0500 Subject: [PATCH 7/9] Delete domains/_github-pages-challenge-axviii3.axviii3.is-cool.dev.json --- ...s-challenge-axviii3.axviii3.is-cool.dev.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_github-pages-challenge-axviii3.axviii3.is-cool.dev.json 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 -} From eeef53f0de8a3ed0d5d1cd87e10039086d0d79a9 Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:51:00 -0500 Subject: [PATCH 8/9] Delete domains/_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft.is-local.org.json --- ...tsoft.bhavesh-acquaintsoft.is-local.org.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 domains/_github-pages-challenge-bhavesh-acquaintsoft.bhavesh-acquaintsoft.is-local.org.json 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 -} From 041a7952512ef6a57aeff134b9b9a5564c578f3e Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 5 Dec 2024 17:52:08 -0500 Subject: [PATCH 9/9] chore: testing --- tests/domains.test.js | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/tests/domains.test.js b/tests/domains.test.js index 0fa7a47f..9d592f4f 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -14,6 +14,8 @@ function isRootDomain(domain) { } 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); @@ -26,24 +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("."); - + // Skip check if the parent subdomain is a root domain if (isRootDomain(parentSubdomain)) { return; } - // Ensure the parent subdomain exists - t.true( - files.includes(`${parentSubdomain}.json`), - `${file}: Parent subdomain ${parentSubdomain}.json does not exist` - ); + // 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); @@ -68,16 +72,15 @@ t("Nested subdomains should not exist if the parent subdomain has NS records", ( 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")}`); });