mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-12 16:15:21 +00:00
stricter url records
This commit is contained in:
1 parent
7c26357424
commit
d6f58f87f1
1 file changed
+1
-6
@@ -165,13 +165,8 @@ t("All files should have valid record values", (t) => {
|
||||
}
|
||||
|
||||
if (key === "URL") {
|
||||
t.true(value.startsWith("http://") || value.startsWith("https://"), `${file}: Record value for ${key} must start with http:// or https://`)
|
||||
t.notThrows(() => new URL(value), `${file}: Invalid URL for ${key}`);
|
||||
try {
|
||||
const urlObj = new URL(value);
|
||||
t.true(urlObj.hostname !== subdomain, `${file}: URL cannot point to itself`);
|
||||
} catch {
|
||||
t.fail(`${file}: Invalid URL for ${key}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user