Initial commit

This commit is contained in:
fraqtal
2026-07-12 08:15:46 +00:00
commit ee0fec0691
1397 changed files with 127242 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
export { stubPayloadConfig } from "./stub-config";
export { mockPayloadModule } from "./mock-payload-module";

View File

@@ -0,0 +1,27 @@
import type { Payload } from "payload";
/**
* @deprecated DO NOT USE — hoisting incompatible.
*
* Vitest statically hoists `vi.mock()` calls to the top of the file.
* This helper wraps `vi.mock()` inside a regular function body, so the
* hoist never fires — the mock is installed too late and the real
* `payload` module loads before being intercepted.
*
* Instead, write at the TOP LEVEL of your test file:
*
* vi.mock("payload", () => ({ getPayload: vi.fn() }));
*
* // then in your test:
* const { getPayload } = await import("payload");
* (getPayload as ReturnType<typeof vi.fn>).mockResolvedValue(yourStub);
*
* This export is preserved only so existing imports don't break and
* agents searching for it find this warning.
*/
export function mockPayloadModule(impl: Partial<Payload>): void {
void impl;
throw new Error(
"mockPayloadModule is deprecated and broken; see JSDoc. Call vi.mock('payload', ...) at the top of your test file instead.",
);
}

View File

@@ -0,0 +1,6 @@
import type { SanitizedConfig } from "payload";
// Minimal SanitizedConfig stub for tests that need to construct repos
// without actually loading the real Payload config. Repository tests
// that mock the `payload` module never read fields off this object.
export const stubPayloadConfig = {} as SanitizedConfig;