rename record key to records

This commit is contained in:
William Harrison committed 2025-04-23 16:32:09 +08:00
1 parent a03e15fc30
commit a39dbde227
7743 files changed
+7781 -7780

No files matched your search

+1 -1
View File
@@ -48,7 +48,7 @@ t("Nested subdomains should not exist if any parent subdomain has NS records", (
if (parent.startsWith("_") || !files.includes(`${parent}.json`)) continue;
const parentData = getDomainData(parent);
t.true(!parentData.record.NS, `${file}: Parent subdomain "${parent}" has NS records`);
t.true(!parentData.records.NS, `${file}: Parent subdomain "${parent}" has NS records`);
}
});
});
+1 -1
View File
@@ -141,7 +141,7 @@ async function processFile(file, t) {
);
}
t.true(Object.keys(data.record).length > 0, `${file}: Missing DNS records`);
t.true(Object.keys(data.records).length > 0, `${file}: Missing DNS records`);
// Check for duplicate keys
const rawData = await fs.readFile(filePath, "utf8");
+1 -1
View File
@@ -30,7 +30,7 @@ function validateProxiedRecords(t, data, file) {
}
if (data.proxied) {
const hasProxiedRecord = Object.keys(data.record).some((key) => requiredRecordsToProxy.has(key));
const hasProxiedRecord = Object.keys(data.records).some((key) => requiredRecordsToProxy.has(key));
t.true(
hasProxiedRecord,
+4 -4
View File
@@ -91,7 +91,7 @@ function isValidHexadecimal(value) {
function validateRecordValues(t, data, file) {
const subdomain = file.replace(/\.json$/, "");
Object.entries(data.record).forEach(([key, value]) => {
Object.entries(data.records).forEach(([key, value]) => {
// General validation for arrays
if (["A", "AAAA", "MX", "NS"].includes(key)) {
t.true(Array.isArray(value), `${file}: Record value for ${key} should be an array`);
@@ -252,7 +252,7 @@ function validateRecordValues(t, data, file) {
// Validate the redirect URL
t.true(
data.record.URL !== customRedirectURL,
data.records.URL !== customRedirectURL,
`${urlMessage} should be different from the URL record at index ${idx}`
);
t.true(
@@ -271,7 +271,7 @@ function validateRecordValues(t, data, file) {
t("All files should have valid record types", (t) => {
files.forEach((file) => {
const data = getDomainData(file);
const recordKeys = Object.keys(data.record);
const recordKeys = Object.keys(data.records);
recordKeys.forEach((key) => {
t.true(validateRecordType(key), `${file}: Invalid record type: ${key}`);
@@ -320,7 +320,7 @@ t("Root subdomains should have at least one usable record", (t) => {
if (subdomain.includes(".") || subdomain.startsWith("_")) return;
const data = getDomainData(file);
const recordKeys = Object.keys(data.record);
const recordKeys = Object.keys(data.records);
t.true(
usableRecordTypes.some((record) => recordKeys.includes(record)),