import { isUuid } from "@stackframe/stack-shared/dist/utils/uuids"; import { it } from "../helpers"; import { createApp, scaffoldProject } from "./js-helpers"; it("should scaffold the project", async ({ expect }) => { const { project } = await scaffoldProject(); expect(project.displayName).toBe("New Project"); }); it("should sign up with credential", async ({ expect }) => { const { clientApp } = await createApp(); const result1 = await clientApp.signUpWithCredential({ email: "test@test.com", password: "password", verificationCallbackUrl: "http://localhost:3000", }); expect(result1).toMatchInlineSnapshot(` { "data": undefined, "status": "ok", } `); const result2 = await clientApp.signInWithCredential({ email: "test@test.com", password: "password", }); expect(result2).toMatchInlineSnapshot(` { "data": undefined, "status": "ok", } `); }); it("should create user on the server", async ({ expect }) => { const { serverApp } = await createApp(); const user = await serverApp.createUser({ primaryEmail: "test@test.com", password: "password", primaryEmailAuthEnabled: true, }); expect(isUuid(user.id)).toBe(true); const user2 = await serverApp.getUser(user.id); expect(user2?.id).toBe(user.id); const result = await serverApp.signInWithCredential({ email: "test@test.com", password: "password", }); expect(result).toMatchInlineSnapshot(` { "data": undefined, "status": "ok", } `); });