39 lines
1.1 KiB
TypeScript
39 lines
1.1 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
import { mergeProjectCatalogItem } from "../src/projectCatalog.ts";
|
|
|
|
test("renaming a project updates its display name without changing stable identifiers", () => {
|
|
const current = [{
|
|
project_id: "human_flow_e2e_20260804_224229",
|
|
tenant_id: "human_flow_e2e_20260804_224229",
|
|
display_name: "人类全流程测试图谱",
|
|
status: "active",
|
|
}];
|
|
|
|
const updated = mergeProjectCatalogItem(current, {
|
|
project_id: "human_flow_e2e_20260804_224229",
|
|
display_name: "人类全流程测试图谱(已重命名)",
|
|
});
|
|
|
|
assert.deepEqual(updated, [{
|
|
project_id: "human_flow_e2e_20260804_224229",
|
|
tenant_id: "human_flow_e2e_20260804_224229",
|
|
display_name: "人类全流程测试图谱(已重命名)",
|
|
status: "active",
|
|
}]);
|
|
assert.notEqual(updated, current);
|
|
});
|
|
|
|
test("an unknown project is added to the catalog", () => {
|
|
const updated = mergeProjectCatalogItem([], {
|
|
project_id: "new_graph",
|
|
display_name: "新图谱",
|
|
});
|
|
|
|
assert.deepEqual(updated, [{
|
|
project_id: "new_graph",
|
|
display_name: "新图谱",
|
|
}]);
|
|
});
|