dist-mcp / mcp / sourceNotation.test.js
dist-mcp / mcp / sourceNotation.test.js
import assert from "node:assert/strict";
import test from "node:test";
import { assertNoAttachmentNotation, UnsupportedAttachmentNotationError } from "./sourceNotation.js";
test("rejects aN in canvas (string form)", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: "a1" }), UnsupportedAttachmentNotationError);
});
test("rejects aN case-insensitively and the bare shorthand form", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: "A5" }), UnsupportedAttachmentNotationError);
assert.throws(() => assertNoAttachmentNotation({ canvas: "a" }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a canvas array", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: ["a2"] }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a moodboard array", () => {
assert.throws(() => assertNoAttachmentNotation({ moodboard: ["v1", "a3"] }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a comma/space-separated moodboard string", () => {
assert.throws(() => assertNoAttachmentNotation({ moodboard: "v1, a3" }), UnsupportedAttachmentNotationError);
assert.throws(() => assertNoAttachmentNotation({ moodboard: "v1 a3" }), UnsupportedAttachmentNotationError);
});
test("passes vN/pN/iN, filenames, and absolute paths through unchanged", () => {
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "v1" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "p2" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "i3" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "source.png" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "/abs/path/source.png" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ moodboard: ["v1", "p2", "i3"] }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ moodboard: "v1, p2 i3" }));
});
test("tolerates missing canvas/moodboard", () => {
assert.doesNotThrow(() => assertNoAttachmentNotation({}));
});
import assert from "node:assert/strict";
import test from "node:test";
import { assertNoAttachmentNotation, UnsupportedAttachmentNotationError } from "./sourceNotation.js";
test("rejects aN in canvas (string form)", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: "a1" }), UnsupportedAttachmentNotationError);
});
test("rejects aN case-insensitively and the bare shorthand form", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: "A5" }), UnsupportedAttachmentNotationError);
assert.throws(() => assertNoAttachmentNotation({ canvas: "a" }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a canvas array", () => {
assert.throws(() => assertNoAttachmentNotation({ canvas: ["a2"] }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a moodboard array", () => {
assert.throws(() => assertNoAttachmentNotation({ moodboard: ["v1", "a3"] }), UnsupportedAttachmentNotationError);
});
test("rejects aN inside a comma/space-separated moodboard string", () => {
assert.throws(() => assertNoAttachmentNotation({ moodboard: "v1, a3" }), UnsupportedAttachmentNotationError);
assert.throws(() => assertNoAttachmentNotation({ moodboard: "v1 a3" }), UnsupportedAttachmentNotationError);
});
test("passes vN/pN/iN, filenames, and absolute paths through unchanged", () => {
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "v1" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "p2" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "i3" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "source.png" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ canvas: "/abs/path/source.png" }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ moodboard: ["v1", "p2", "i3"] }));
assert.doesNotThrow(() => assertNoAttachmentNotation({ moodboard: "v1, p2 i3" }));
});
test("tolerates missing canvas/moodboard", () => {
assert.doesNotThrow(() => assertNoAttachmentNotation({}));
});