From e35b57068b11083c030defda96db415dbea5b661 Mon Sep 17 00:00:00 2001 From: Daniel Salazar Date: Wed, 22 Jul 2026 21:13:44 -0700 Subject: [PATCH] test: add extra tests (#3428) --- src/backend/services/auth/AuthService.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/backend/services/auth/AuthService.test.ts b/src/backend/services/auth/AuthService.test.ts index 5a8f68d9a..24ac8a0cb 100644 --- a/src/backend/services/auth/AuthService.test.ts +++ b/src/backend/services/auth/AuthService.test.ts @@ -1396,6 +1396,23 @@ describe('AuthService (integration)', () => { ).resolves.toBeNull(); }); + it('returns null for a subdomain of the main domain', async () => { + // `.puter.localhost` sits under the main `domain`, not a + // hosting domain — no owner resolves even when a subdomain row + // with the same name exists. + const user = await makeUser(); + const subdomain = `own-${Math.random().toString(36).slice(2, 10)}`; + await server.stores.subdomain.create({ + userId: user.id, + subdomain, + }); + await expect( + authService.subdomainOwnerIdFromOrigin( + `https://${subdomain}.puter.localhost`, + ), + ).resolves.toBeNull(); + }); + it('returns null for an unregistered subdomain and for the apex host', async () => { await expect( authService.subdomainOwnerIdFromOrigin(