mirror of
https://github.com/Since-3/Kuma.git
synced 2026-10-12 19:01:16 +00:00
see comments
This commit is contained in:
parent
51e6f4cd2a
commit
e2a419a343
3 changed files with 12 additions and 7 deletions
|
|
@ -70,12 +70,14 @@ describe("POST /api/upload/avatar", () => {
|
|||
const res = await POST(makeRequest(null, "valid-token"));
|
||||
expect(res.status).toBe(400);
|
||||
const data = await res.json();
|
||||
expect(data.error).toContain("Token");
|
||||
expect(data.error).toContain("Datei und Token erforderlich");
|
||||
});
|
||||
|
||||
it("gibt 400 zurück wenn Token fehlt", async () => {
|
||||
const res = await POST(makeRequest(makeImageFile(), null));
|
||||
expect(res.status).toBe(400);
|
||||
const data = await res.json();
|
||||
expect(data.error).toContain("Datei und Token erforderlich");
|
||||
});
|
||||
|
||||
it("gibt 401 zurück bei ungültigem Token", async () => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
import { describe, it, expect, vi, beforeEach } from "vitest";
|
||||
import { renderHook, act } from "@testing-library/react";
|
||||
|
||||
const { mockRouterPush, mockSetUser, mockSupabaseSignIn } = vi.hoisted(() => ({
|
||||
mockRouterPush: vi.fn(),
|
||||
mockSetUser: vi.fn(),
|
||||
mockSupabaseSignIn: vi.fn(),
|
||||
}));
|
||||
|
||||
vi.mock("next/navigation", () => ({
|
||||
useRouter: () => ({ push: mockRouterPush }),
|
||||
}));
|
||||
|
|
@ -18,10 +24,6 @@ vi.mock("sonner", () => ({
|
|||
toast: { success: vi.fn(), error: vi.fn() },
|
||||
}));
|
||||
|
||||
const mockRouterPush = vi.fn();
|
||||
const mockSetUser = vi.fn();
|
||||
const mockSupabaseSignIn = vi.fn();
|
||||
|
||||
import { useAuth } from "@/src/hooks/useAuth";
|
||||
|
||||
beforeEach(() => {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@
|
|||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
|
|
@ -30,5 +31,5 @@
|
|||
".next/dev/types/**/*.ts",
|
||||
"**/*.mts"
|
||||
],
|
||||
"exclude": ["node_modules", "vitest.setup.ts", "vitest.config.ts", "tests/**"]
|
||||
"exclude": ["node_modules", "vitest.setup.ts", "vitest.config.ts"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue