Passer au contenu principal

Documentation Index

Fetch the complete documentation index at: https://kubo-47e69177.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Testing Patterns

Statut CI en direct

CI

Lancer les tests localement

terminal
pnpm test
Dernier run local dans ce repository:
terminal output
@zapaction/core:  Test Files 5 passed, Tests 35 passed
@zapaction/react: Test Files 2 passed, Tests 14 passed
@zapaction/query: Test Files 3 passed, Tests 6 passed
Total tests passed: 55

Test de contrat d’action

features/todos/actions.test.ts
import { beforeEach, describe, expect, it, vi } from "vitest";
import { __resetActionContextForTests, setActionContext } from "@zapaction/core";
import { createTodo } from "./actions";

vi.mock("next/cache", () => ({ revalidateTag: vi.fn() }));

describe("createTodo", () => {
  beforeEach(() => {
    __resetActionContextForTests();
    setActionContext(async () => ({ userId: "test-user" }));
  });

  it("cree un todo valide", async () => {
    const result = await createTodo({ title: "Ecrire des tests" });
    expect(result.title).toContain("Ecrire des tests");
  });
});