Skip to content

Commit e5d879d

Browse files
Add update subdomain test
1 parent 636c6cc commit e5d879d

File tree

1 file changed

+23
-2
lines changed

1 file changed

+23
-2
lines changed

tests/subdomains.test.js

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { vi } from "vitest";
22
import { it } from "vitest";
33
import { describe } from "vitest";
4-
import { createSubdomain, deleteSubdomain, getSubdomains } from "../src/commands/subdomains";
4+
import { createSubdomain, deleteSubdomain, getSubdomains, updateSubdomain } from "../src/commands/subdomains";
55
import { expect } from "vitest";
66
import { getPuter } from "../src/modules/PuterModule";
77

@@ -66,4 +66,25 @@ describe("createSubdomain", () => {
6666
subdomain: "hehe.puter.site"
6767
})
6868
})
69-
})
69+
})
70+
71+
describe("updateSubdomain", () => {
72+
it("should update subdomain successfully", async () => {
73+
const mockHostingUpdate = vi.fn().mockResolvedValue({
74+
uid: "123",
75+
subdomain: "hehe.puter.site",
76+
root_dir: { path: "/newdir" },
77+
});
78+
vi.mocked(getPuter).mockReturnValue({
79+
hosting: {
80+
update: mockHostingUpdate
81+
}
82+
})
83+
const result = await updateSubdomain("hehe", "/newdir")
84+
expect(result).toMatchObject({
85+
root_dir: {
86+
path: "/newdir"
87+
}
88+
})
89+
})
90+
})

0 commit comments

Comments
 (0)