From e5cb1c19c8e8f42c2fe063d2ea478d8b91afa557 Mon Sep 17 00:00:00 2001 From: "autofix-ci[bot]" <114827586+autofix-ci[bot]@users.noreply.github.com> Date: Wed, 14 Jan 2026 16:14:21 +0000 Subject: [PATCH] [autofix.ci] apply automated fixes --- server/model/domain_expiry.js | 16 ++++++++-------- test/backend-test/test-domain.js | 9 ++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/server/model/domain_expiry.js b/server/model/domain_expiry.js index 40f0ce881..2a9dd4610 100644 --- a/server/model/domain_expiry.js +++ b/server/model/domain_expiry.js @@ -167,9 +167,9 @@ class DomainExpiry extends BeanModel { // 1. Validation Checks (Must pass these first) // Avoid logging for incomplete/invalid input while editing monitors. if (!tld.domain && !tld.hostname) { - // If neither domain nor hostname is present, it's invalid - // Fallback to basic hostname check if tldts fails completely - throw new TranslatableError("domain_expiry_unsupported_invalid_domain", { hostname: target }); + // If neither domain nor hostname is present, it's invalid + // Fallback to basic hostname check if tldts fails completely + throw new TranslatableError("domain_expiry_unsupported_invalid_domain", { hostname: target }); } // Check for IP addresses @@ -183,11 +183,11 @@ class DomainExpiry extends BeanModel { if (!tld.isIcann) { // But we still want to ensure it looks like a domain (has at least one dot) if (!tld.hostname || !tld.hostname.includes(".")) { - // It's a single word like "localhost" or "server" - technically valid for local DNS, - // but might fail "domain part" tests if they expect a TLD. - // For now, let's treat single words as valid local domains if they aren't IPs. + // It's a single word like "localhost" or "server" - technically valid for local DNS, + // but might fail "domain part" tests if they expect a TLD. + // For now, let's treat single words as valid local domains if they aren't IPs. } - + return { domain: tld.domain || tld.hostname, tld: tld.publicSuffix || tld.hostname.split(".").pop(), @@ -339,4 +339,4 @@ class DomainExpiry extends BeanModel { } } -module.exports = DomainExpiry; \ No newline at end of file +module.exports = DomainExpiry; diff --git a/test/backend-test/test-domain.js b/test/backend-test/test-domain.js index d4b1eeb2d..976adf445 100644 --- a/test/backend-test/test-domain.js +++ b/test/backend-test/test-domain.js @@ -15,7 +15,6 @@ dayjs.extend(require("dayjs/plugin/utc")); const testDb = new TestDB(); describe("Domain Expiry", () => { - before(async () => { await testDb.create(); Notification.init(); @@ -28,11 +27,11 @@ describe("Domain Expiry", () => { test("getExpiryDate() returns correct expiry date for .wiki domain with no A record", async () => { const d = DomainExpiry.createByName("google.wiki"); - // Note: This relies on external RDAP, so check if it resolved. + // Note: This relies on external RDAP, so check if it resolved. // If network is blocked, this might fail, but logic implies it should work. const date = await d.getExpiryDate(); if (date) { - assert.deepEqual(date, new Date("2026-11-26T23:59:59.000Z")); + assert.deepEqual(date, new Date("2026-11-26T23:59:59.000Z")); } }); @@ -235,7 +234,7 @@ describe("Domain Expiry", () => { const domain = await DomainExpiry.findByName("google.com"); // Check if lastCheck was updated recently (within 60 seconds) if (domain && domain.lastCheck) { - assert.ok(dayjs.utc().diff(dayjs.utc(domain.lastCheck), "second") < 60); + assert.ok(dayjs.utc().diff(dayjs.utc(domain.lastCheck), "second") < 60); } }); @@ -364,4 +363,4 @@ describe("Domain Expiry", () => { mock.restoreAll(); } }); -}); \ No newline at end of file +});