Add support for message history pagination, preserve scroll in rendering, and improve draft/message workflows.
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import test from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import {createWorkspaceTransfer} from "../public/js/workspaceTransfer.js";
|
||||
|
||||
test("export cancellation makes no request and failed downloads report structured server errors", async t => {
|
||||
let requests = 0, format = null;
|
||||
t.mock.method(globalThis, "fetch", async () => { requests++; return Response.json({error: "Session expired", code: "LOGIN_REQUIRED"}, {status: 403}); });
|
||||
const notices = [];
|
||||
const transfer = createWorkspaceTransfer({conversation: {activeChatId: 1, currentMessages: [{}]}, getChatById: () => ({id: 1, title: "Chat"}),
|
||||
setNotice: (text, kind) => notices.push({text, kind}), promptPopup: async () => format});
|
||||
await transfer.exportCurrentChat(); assert.equal(requests, 0);
|
||||
format = "md";
|
||||
await transfer.exportCurrentChat();
|
||||
await transfer.backupWorkspace();
|
||||
assert.equal(requests, 2);
|
||||
assert.deepEqual(notices, [{text: "Session expired", kind: "error"}, {text: "Session expired", kind: "error"}]);
|
||||
});
|
||||
Reference in New Issue
Block a user