From be14c3203553cecabcbc319409a5a70bd9829b4d Mon Sep 17 00:00:00 2001 From: DIBSTER <76603072+DEV-DIBSTER@users.noreply.github.com> Date: Thu, 18 Sep 2025 15:28:53 +0000 Subject: [PATCH] feat: new test case to make sure TXT records are arrays --- tests/json.test.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/json.test.js b/tests/json.test.js index aca87b76..720011e0 100644 --- a/tests/json.test.js +++ b/tests/json.test.js @@ -192,3 +192,21 @@ t("All files in the domains directory must have a .json extension", (t) => { t.pass(); } }); + +t("TXT Records should be arrays not just strings", (t) => { + const files = fs.readdirSync(domainsPath).filter(file => { + const filePath = path.join(domainsPath, file); + return file.endsWith(".json") && fs.lstatSync(filePath).isFile(); + }); + + files.forEach(file => { + const filePath = path.join(domainsPath, file); + const data = fs.readJsonSync(filePath); + if (data.record && data.record.TXT !== undefined) { + t.true(Array.isArray(data.record.TXT), `${file}: TXT record should be an array`); + data.record.TXT.forEach((txt, idx) => { + t.is(typeof txt, "string", `${file}: TXT record at index ${idx} should be a string`); + }); + } + }); +}); \ No newline at end of file