Merge pull request #2696 from open-domains/new-test-case

feat: new test case to make sure TXT records are arrays
This commit is contained in:
andrewstech authored and GitHub committed 2025-09-20 09:12:56 +01:00
commit 144b0ed84e
1 file changed
+18
+18
View File
@@ -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`);
});
}
});
});