feat : use guide login only [no ci]

This commit is contained in:
2026-10-06 18:41:28 +07:00 Unverified
parent 1339dd43e6
commit 3c8f60433a
28 changed files with 50 additions and 783 deletions
-8
View File
@@ -7,12 +7,10 @@ const returning = vi.fn();
const where = vi.fn(() => ({ returning }));
const set = vi.fn(() => ({ where }));
const write = vi.fn();
const linkedAccounts = vi.fn();
vi.mock("@/lib/commission/server", () => ({ requireCommissionUser }));
vi.mock("@/db", () => ({ getDb: () => ({
update: () => ({ set }),
select: () => ({ from: () => ({ where: () => ({ limit: linkedAccounts }) }) }),
}) }));
vi.mock("@/lib/media/storage", () => ({ getMediaStorage: async () => ({ write }), publicMediaUrl: (key: string) => `https://cdn.test/${key}` }));
vi.mock("@/lib/security/rate-limit", () => ({ limitRequest: async () => undefined }));
@@ -31,7 +29,6 @@ describe("profile update", () => {
process.env.BETTER_AUTH_URL = "https://guide.sudloh.com";
vi.clearAllMocks();
requireCommissionUser.mockResolvedValue({ id: "user-1", image: null });
linkedAccounts.mockResolvedValue([]);
returning.mockResolvedValue([{ name: "New Name", image: null }]);
});
@@ -66,9 +63,4 @@ describe("profile update", () => {
expect(set).not.toHaveBeenCalled();
});
it("sends Sudloh-linked users to Sudloh for profile changes", async () => {
linkedAccounts.mockResolvedValueOnce([{ id: "sudloh-account" }]);
expect((await POST(profileRequest("New Name"))).status).toBe(403);
expect(set).not.toHaveBeenCalled();
});
});