Skip to content

Commit d3a4f98

Browse files
Add mock current dir
1 parent be05172 commit d3a4f98

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

tests/sites.test.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@ import { describe, vi, expect, it } from "vitest";
22
import { createSite, deleteSite, infoSite, listSites } from "../src/commands/sites";
33
import { createSubdomain, deleteSubdomain, getSubdomains } from "../src/commands/subdomains";
44
import { getPuter } from "../src/modules/PuterModule.js";
5+
import { getCurrentDirectory } from "../src/commands/auth.js";
56

67
vi.mock("../src/commands/subdomains")
78
vi.mock("../src/modules/PuterModule")
9+
vi.mock('../src/commands/auth.js');
10+
811
vi.spyOn(console, "log").mockImplementation(() => { });
912

1013
describe("listSites", () => {
@@ -55,6 +58,7 @@ describe("createSite", () => {
5558
subdomain: "hehe.puter.site",
5659
root_dir: { path: "/some/path" },
5760
})
61+
vi.mocked(getCurrentDirectory).mockReturnValue('/testuser');
5862
const result = await createSite(["hehe hehe --subdomain=hehe"]);
5963
expect(result).toMatchObject({
6064
subdomain: "hehe.puter.site"

0 commit comments

Comments
 (0)