loginPage.test.ts 655 B

12345678910111213
  1. import { describe, expect, it } from "vitest";
  2. describe("WelcomeScreen", () => {
  3. it("已有用户不会完成新发起的 Provider 登录尝试", async () => {
  4. const { shouldCompleteLoginFromExistingUser, shouldCompleteProviderLoginAttempt } =
  5. await import("@/WelcomeScreen.js");
  6. const attempt = { id: 9, providerId: "bigmodel" as const };
  7. expect(shouldCompleteLoginFromExistingUser({ hasUser: true, attempt })).toBe(false);
  8. expect(shouldCompleteProviderLoginAttempt({ attempt, successProvider: "zai" })).toBe(false);
  9. expect(shouldCompleteProviderLoginAttempt({ attempt, successProvider: "bigmodel" })).toBe(true);
  10. });
  11. });