refactoring van de cmap structuren bijna compleet
This commit is contained in:
@@ -4,8 +4,8 @@ import assert from "node:assert/strict";
|
||||
import {
|
||||
CmapRepository,
|
||||
StoredConceptMap
|
||||
} from "../static/cmap/model/cmap-repository.js";
|
||||
import { CmapModel } from "../static/cmap/model/concept-map.js";
|
||||
} from "../static/js/cmap/model/cmap-repository.js";
|
||||
import { CmapModel } from "../static/js/cmap/model/concept-map.js";
|
||||
|
||||
const documentValue = {
|
||||
schemaVersion: 2,
|
||||
@@ -19,7 +19,8 @@ test("CmapRepository decodes backend documents and normalizes legacy concept ids
|
||||
slug: "roadmap",
|
||||
title: "Roadmap",
|
||||
currentVersion: 3,
|
||||
document: JSON.stringify(JSON.stringify(documentValue))
|
||||
document: JSON.stringify(JSON.stringify(documentValue)),
|
||||
renderedSvg: "<svg></svg>"
|
||||
}));
|
||||
|
||||
const storedMap = await repository.load("roadmap");
|
||||
@@ -29,6 +30,7 @@ test("CmapRepository decodes backend documents and normalizes legacy concept ids
|
||||
assert.equal(storedMap.currentVersion, 3);
|
||||
assert.equal(storedMap.toDocument().concepts[0].id, "legacy:roadmap:concept-1");
|
||||
assert.equal(storedMap.toDocument().items[0].conceptId, "legacy:roadmap:concept-1");
|
||||
assert.equal(storedMap.renderedSvg, "<svg></svg>");
|
||||
});
|
||||
|
||||
test("CmapRepository serializes model saves with backend version information", async () => {
|
||||
@@ -47,7 +49,8 @@ test("CmapRepository serializes model saves with backend version information", a
|
||||
const savedMap = await repository.save(storedMap, storedMap.model, {
|
||||
summary: "Manual save",
|
||||
saveKind: "manual",
|
||||
snapshot: true
|
||||
snapshot: true,
|
||||
renderedSvg: "<svg xmlns=\"http://www.w3.org/2000/svg\"></svg>"
|
||||
});
|
||||
|
||||
assert.equal(savedMap.currentVersion, 2);
|
||||
@@ -57,6 +60,7 @@ test("CmapRepository serializes model saves with backend version information", a
|
||||
assert.equal(body.summary, "Manual save");
|
||||
assert.equal(body.saveKind, "manual");
|
||||
assert.equal(body.snapshot, true);
|
||||
assert.equal(body.renderedSvg, "<svg xmlns=\"http://www.w3.org/2000/svg\"></svg>");
|
||||
assert.deepEqual(body.document.concepts, storedMap.toDocument().concepts);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user