safe-action-testing
Installation
SKILL.md
Testing next-safe-action
Testing Actions Directly
Server actions are async functions — call them directly in tests:
// src/__tests__/actions.test.ts
import { describe, it, expect, vi } from "vitest";
import { createUser } from "@/app/actions";
describe("createUser", () => {
it("returns user data on valid input", async () => {
const result = await createUser({ name: "Alice", email: "alice@example.com" });