From 86d2d09ead4685e366b7d1dcbdb6997bf9578f2d Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:25:35 +0800 Subject: [PATCH 1/3] feat(ci): root subdomains must have atleast one usable record --- tests/records.test.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/tests/records.test.js b/tests/records.test.js index 52fb1f677..47aed54d1 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -216,7 +216,10 @@ function validateRecordValues(t, data, file) { Number.isInteger(record.matchingType) && record.matchingType >= 0 && record.matchingType <= 255, `${file}: Invalid matchingType for ${key} at index ${idx}` ); - t.true(isValidHexadecimal(record.certificate), `${file}: Invalid certificate for ${key} at index ${idx}`); + t.true( + isValidHexadecimal(record.certificate), + `${file}: Invalid certificate for ${key} at index ${idx}` + ); } }); } @@ -310,3 +313,19 @@ t("All files should have valid record types", (t) => { t.pass(); }); + +t("Root domains should have at least one usable record", (t) => { + const usableRecordTypes = ["A", "AAAA", "CNAME", "MX", "NS", "URL"]; + + files.forEach((file) => { + if (file.replace(/\.json$/, "").includes(".")) return; + + const data = getDomainData(file); + const recordKeys = Object.keys(data.record); + + t.true( + usableRecordTypes.some((record) => recordKeys.includes(record)), + `${file}: Root subdomains must have at least one A, AAAA, CNAME, MX, NS, or URL record` + ); + }); +}); From c7077c039d0cdfa9f90c4c827986fa389b6018a8 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:27:00 +0800 Subject: [PATCH 2/3] Update records.test.js --- tests/records.test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/records.test.js b/tests/records.test.js index 47aed54d1..6926a88f2 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -314,7 +314,7 @@ t("All files should have valid record types", (t) => { t.pass(); }); -t("Root domains should have at least one usable record", (t) => { +t("Root subdomains should have at least one usable record", (t) => { const usableRecordTypes = ["A", "AAAA", "CNAME", "MX", "NS", "URL"]; files.forEach((file) => { From 1b9ea978b33ca2b50bed991d690c04f1d14f8865 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Fri, 4 Apr 2025 14:28:51 +0800 Subject: [PATCH 3/3] chore(ci): allow subdomains starting with underscores to have non-usable records --- tests/records.test.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/records.test.js b/tests/records.test.js index 6926a88f2..573e0604e 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -318,7 +318,8 @@ t("Root subdomains should have at least one usable record", (t) => { const usableRecordTypes = ["A", "AAAA", "CNAME", "MX", "NS", "URL"]; files.forEach((file) => { - if (file.replace(/\.json$/, "").includes(".")) return; + const subdomain = file.replace(/\.json$/, ""); + if (subdomain.includes(".") || subdomain.startsWith("_")) return; const data = getDomainData(file); const recordKeys = Object.keys(data.record);