mirror of
https://github.com/mksglu/context-mode.git
synced 2026-10-02 04:14:38 +08:00
fix(test): make qwen path assertion separator-agnostic for Windows CI
qwenChatJsonlPath uses path.join (OS-native), so on windows-latest the real path uses backslashes; the test hard-coded a forward-slash literal and failed. Build the expected with join() so it matches on every platform. macOS/Linux unaffected.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { createHash } from "node:crypto";
|
||||
import { join } from "node:path";
|
||||
import { parseQwenUsage, extractQwenUsageSince, qwenProjectHash, qwenChatJsonlPath } from "../../src/adapters/qwen-code/usage.js";
|
||||
import { buildAgentUsageEvent } from "../../src/session/extract.js";
|
||||
|
||||
@@ -207,8 +208,11 @@ describe("qwenChatJsonlPath", () => {
|
||||
const root = "/work/proj";
|
||||
const sid = "sess-abc";
|
||||
const hash = qwenProjectHash(root);
|
||||
// Build the expected with join() so the assertion is separator-agnostic:
|
||||
// qwenChatJsonlPath uses path.join (OS-native), so on win32 the real path
|
||||
// uses backslashes — a hard-coded forward-slash literal fails there.
|
||||
expect(qwenChatJsonlPath(home, root, sid)).toBe(
|
||||
`/home/u/.qwen/tmp/${hash}/chats/${sid}.jsonl`,
|
||||
join(home, "tmp", hash, "chats", `${sid}.jsonl`),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user