ReMe/reme_studio/tests/workspace-persistence.test.mjs
jinliyl ef3f99f019
refactor(packaging): reorganize published packages (#495)
* refactor(packaging): reorganize published packages

* fix(packaging): install AgentScope extra in wheel smoke

* docs: align package guides and documentation site

* ci(workflow): add core dependency verification step in Python package build

- Add a workflow step to verify released core dependencies by installing the wheel with core extras
- Assert the presence of the static index.html file to ensure proper package contents
- Create and use a temporary virtual environment for isolation during verification
- Keep existing artifacts upload step intact and conditional on inputs.upload_artifacts flag

* fix(ci): update package installation dependencies in Windows workflow

- Change pip install from editable reme_studio and core to only dev and as extras
- Remove installation of reme_studio and core to streamline dependency setup
- Ensure Windows CI uses the correct extras for testing environment

* fix(tests): add missing commas in toml file reads in package version tests

- Added trailing commas in the tomllib.loads calls for auto-fin and daily_paper configs
- Ensured consistent syntax to prevent potential tuple misinterpretation
- Improved readability and correctness of the test setup code

* fix(packaging): protect qwenpaw releases and test Studio health
2026-08-27 14:02:09 +08:00

86 lines
2.1 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { prepareWorkspaceSnapshot } from "../app/workspace-persistence.ts";
test("workspace snapshot reloads saved files but preserves unsaved drafts", () => {
const saved = {
id: "file:saved.md",
type: "markdown",
title: "saved.md",
path: "saved.md",
content: "saved",
savedContent: "saved",
};
const draft = {
id: "file:draft.md",
type: "markdown",
title: "draft.md",
path: "draft.md",
content: "draft",
savedContent: "saved",
};
const snapshot = prepareWorkspaceSnapshot([saved, draft], draft.id);
assert.deepEqual(snapshot.tabs[0], {
...saved,
content: "",
savedContent: "",
loading: true,
error: undefined,
});
assert.deepEqual(snapshot.tabs[1], {
...draft,
loading: false,
error: undefined,
});
assert.equal(snapshot.activeTabId, draft.id);
});
test("workspace snapshot keeps chat session and finishes interrupted blocks", () => {
const chat = {
id: "agent:one",
type: "agent",
title: "Chat",
sessionId: "session-1",
streaming: true,
messages: [
{
id: "assistant",
role: "assistant",
content: "",
blocks: [
{
id: "think:one",
type: "think",
sourceType: "think",
payloads: ["working"],
status: "streaming",
expanded: true,
},
],
},
],
};
const snapshot = prepareWorkspaceSnapshot([chat], chat.id);
const restored = snapshot.tabs[0];
assert.equal(restored.sessionId, "session-1");
assert.equal(restored.streaming, false);
assert.equal(restored.messages[0].blocks[0].status, "done");
assert.equal(restored.messages[0].blocks[0].expanded, false);
});
test("workspace snapshot preserves an open memory graph", () => {
const graph = {
id: "graph:wiki",
type: "graph",
title: "wiki graph",
root: "wiki",
};
const snapshot = prepareWorkspaceSnapshot([graph], graph.id);
assert.deepEqual(snapshot.tabs, [graph]);
assert.equal(snapshot.activeTabId, graph.id);
});