Skip to content

armgit / memos

Public Imported from GitHub
0

Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.

1.0 KB
Raw Blame
import { render, screen } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
import PasswordSignInForm from "@/components/PasswordSignInForm";

vi.mock("@/auth-state", () => ({ setAccessToken: vi.fn() }));

vi.mock("@/connect", () => ({
  authServiceClient: { signIn: vi.fn() },
}));

vi.mock("@/contexts/AuthContext", () => ({
  useAuth: () => ({ initialize: vi.fn() }),
}));

// The challenge widget reads the instance profile; no challenge is configured here.
vi.mock("@/contexts/InstanceContext", () => ({
  useInstance: () => ({ profile: { challenge: undefined } }),
}));

vi.mock("@/hooks/useNavigateTo", () => ({
  default: () => vi.fn(),
}));

vi.mock("@/utils/i18n", () => ({
  useTranslate: () => (key: string) => key,
}));

describe("<PasswordSignInForm>", () => {
  it("does not prefill seeded demo credentials", () => {
    render(<PasswordSignInForm />);

    expect(screen.getByPlaceholderText("common.username")).toHaveValue("");
    expect(screen.getByPlaceholderText("common.password")).toHaveValue("");
  });
});