From fd6e54f12274623fe551a9b51bb7b863cbced289 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 22 Jul 2026 12:58:13 +0530 Subject: [PATCH] refactor: remove test file for use-resolved-tabs to streamline codebase --- surfsense_web/hooks/use-resolved-tabs.test.ts | 47 ------------------- 1 file changed, 47 deletions(-) delete mode 100644 surfsense_web/hooks/use-resolved-tabs.test.ts diff --git a/surfsense_web/hooks/use-resolved-tabs.test.ts b/surfsense_web/hooks/use-resolved-tabs.test.ts deleted file mode 100644 index dfad6a5a6..000000000 --- a/surfsense_web/hooks/use-resolved-tabs.test.ts +++ /dev/null @@ -1,47 +0,0 @@ -import assert from "node:assert/strict"; -import { test } from "node:test"; -import { getMissingChatIds, resolveTabPointers, type ResolvedTab } from "./use-resolved-tabs"; - -// Run with: pnpm exec tsx --test hooks/use-resolved-tabs.test.ts -test("does not prune chat tabs that have not resolved as missing", () => { - const missing = getMissingChatIds({ - tabs: [{ id: "chat-42", type: "chat", entityId: 42, workspaceId: 7 }], - notFoundIds: new Set(), - }); - - assert.equal(missing.size, 0); -}); - -test("prunes only chat tabs whose thread resolved as not found", () => { - const missing = getMissingChatIds({ - tabs: [ - { id: "chat-42", type: "chat", entityId: 42, workspaceId: 7 }, - { id: "chat-43", type: "chat", entityId: 43, workspaceId: 7 }, - ], - notFoundIds: new Set([42]), - }); - - assert.deepEqual([...missing], [42]); -}); - -test("merges pointer tabs with synced row titles", () => { - const resolved = resolveTabPointers({ - tabs: [ - { id: "chat-42", type: "chat", entityId: 42, workspaceId: 7 }, - { id: "doc-9", type: "document", entityId: 9, workspaceId: 7 }, - ], - threadRows: [{ id: 42, title: "Live chat title", visibility: "SEARCH_SPACE" }], - documentRows: [{ id: 9, title: "Live document title" }], - }); - - assert.deepEqual( - resolved.map((tab): Pick => ({ - id: tab.id, - title: tab.title, - })), - [ - { id: "chat-42", title: "Live chat title" }, - { id: "doc-9", title: "Live document title" }, - ] - ); -});