






















@@ -3,6 +3,7 @@ import os from "node:os";
33import path from "node:path";
44import { afterEach, beforeEach, describe, expect, it } from "vitest";
55import { captureEnv } from "../../test-utils/env.js";
6+import { AUTH_STORE_VERSION } from "./constants.js";
67import {
78resolveAuthStatePath,
89resolveAuthStatePathForDisplay,
@@ -84,19 +85,13 @@ describe("path-resolve helpers (direct-import coverage attribution)", () => {
8485// tilde path back instead of expanding it via resolveUserPath.
8586const tildeAgentDir = "~fake-openclaw-no-expand";
8687const resolved = resolveAuthStorePathForDisplay(tildeAgentDir);
87-// Either the path itself starts with `~`, or the display variant
88-// happened to resolve through the user-path branch. Both branches are
89-// valid; the point is just that the function returned a string and
90-// the branch was executed.
91-expect(typeof resolved).toBe("string");
92-expect(resolved.length).toBeGreaterThan(0);
88+expect(resolved).toBe(path.resolve(tildeAgentDir, "auth-profiles.json"));
9389});
949095-it("resolveAuthStatePathForDisplay returns a string", () => {
91+it("resolveAuthStatePathForDisplay returns the auth-state path for a non-tilde input", () => {
9692const agentDir = path.join(stateDir, "agents", "main", "agent");
9793const resolved = resolveAuthStatePathForDisplay(agentDir);
98-expect(typeof resolved).toBe("string");
99-expect(resolved.length).toBeGreaterThan(0);
94+expect(resolved).toBe(path.join(agentDir, "auth-state.json"));
10095});
10196});
10297@@ -119,7 +114,7 @@ describe("ensureAuthStoreFile (direct-import coverage attribution)", () => {
119114ensureAuthStoreFile(target);
120115const raw = await fs.readFile(target, "utf8");
121116const parsed = JSON.parse(raw) as { version: number; profiles: Record<string, unknown> };
122-expect(parsed.version).toBeGreaterThanOrEqual(1);
117+expect(parsed.version).toBe(AUTH_STORE_VERSION);
123118expect(parsed.profiles).toStrictEqual({});
124119});
125120此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。