mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-26 23:51:14 +02:00
refactor: remove test file for use-resolved-tabs to streamline codebase
This commit is contained in:
parent
71b1288a7a
commit
fd6e54f122
1 changed files with 0 additions and 47 deletions
|
|
@ -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<number>(),
|
||||
});
|
||||
|
||||
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<ResolvedTab, "id" | "title"> => ({
|
||||
id: tab.id,
|
||||
title: tab.title,
|
||||
})),
|
||||
[
|
||||
{ id: "chat-42", title: "Live chat title" },
|
||||
{ id: "doc-9", title: "Live document title" },
|
||||
]
|
||||
);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue