test: normalize windows path assertions
This commit is contained in:
@@ -26,7 +26,10 @@ describe("media store", () => {
|
|||||||
|
|
||||||
it("creates and returns media directory", async () => {
|
it("creates and returns media directory", async () => {
|
||||||
const dir = await store.ensureMediaDir();
|
const dir = await store.ensureMediaDir();
|
||||||
expect(dir).toContain("clawdbot-home-test");
|
const normalized = path.normalize(dir);
|
||||||
|
expect(normalized).toContain(
|
||||||
|
`${path.sep}.clawdbot${path.sep}media`,
|
||||||
|
);
|
||||||
const stat = await fs.stat(dir);
|
const stat = await fs.stat(dir);
|
||||||
expect(stat.isDirectory()).toBe(true);
|
expect(stat.isDirectory()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -47,7 +47,17 @@ describe("web logout", () => {
|
|||||||
async () => {
|
async () => {
|
||||||
const { logoutWeb, WA_WEB_AUTH_DIR } = await import("./session.js");
|
const { logoutWeb, WA_WEB_AUTH_DIR } = await import("./session.js");
|
||||||
|
|
||||||
expect(WA_WEB_AUTH_DIR.startsWith(tmpDir)).toBe(true);
|
const normalizedAuthDir = path.resolve(WA_WEB_AUTH_DIR);
|
||||||
|
const normalizedHome = path.resolve(tmpDir);
|
||||||
|
if (process.platform === "win32") {
|
||||||
|
expect(
|
||||||
|
normalizedAuthDir
|
||||||
|
.toLowerCase()
|
||||||
|
.startsWith(normalizedHome.toLowerCase()),
|
||||||
|
).toBe(true);
|
||||||
|
} else {
|
||||||
|
expect(normalizedAuthDir.startsWith(normalizedHome)).toBe(true);
|
||||||
|
}
|
||||||
fs.mkdirSync(WA_WEB_AUTH_DIR, { recursive: true });
|
fs.mkdirSync(WA_WEB_AUTH_DIR, { recursive: true });
|
||||||
fs.writeFileSync(path.join(WA_WEB_AUTH_DIR, "creds.json"), "{}");
|
fs.writeFileSync(path.join(WA_WEB_AUTH_DIR, "creds.json"), "{}");
|
||||||
const result = await logoutWeb({ runtime: runtime as never });
|
const result = await logoutWeb({ runtime: runtime as never });
|
||||||
|
|||||||
Reference in New Issue
Block a user