修复快照完整性:raw/llm_wiki 由 gitlink 转为普通目录(.git 备份为 .git.bak),新增 .gitignore 排除 __pycache__/pyc 与子仓库元数据
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import assert from "node:assert/strict"
|
||||
import { readFileSync } from "node:fs"
|
||||
import { test } from "node:test"
|
||||
import { FALLBACK_VERSION, VERSION, loadMcpServerVersion } from "../src/version.js"
|
||||
|
||||
const pkg = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")) as {
|
||||
version: string
|
||||
}
|
||||
|
||||
test("MCP server version is read from package.json", () => {
|
||||
assert.equal(VERSION, pkg.version)
|
||||
})
|
||||
|
||||
test("MCP server version supports source-layout execution", () => {
|
||||
assert.equal(
|
||||
loadMcpServerVersion(new URL("../../src/version.ts", import.meta.url).href),
|
||||
pkg.version,
|
||||
)
|
||||
})
|
||||
|
||||
test("MCP server version falls back when package.json cannot be found", () => {
|
||||
assert.equal(loadMcpServerVersion("file:///tmp/llm-wiki-missing/dist/src/version.js"), FALLBACK_VERSION)
|
||||
})
|
||||
|
||||
test("MCP server version falls back for invalid meta URLs", () => {
|
||||
assert.equal(loadMcpServerVersion("not a url"), FALLBACK_VERSION)
|
||||
})
|
||||
Reference in New Issue
Block a user