Skip to content

Commit a06b5d9

Browse files
committed
test(ui): stabilize client page mocks and fix activity table expectations
1 parent 66a4d61 commit a06b5d9

File tree

8 files changed

+133
-203
lines changed

8 files changed

+133
-203
lines changed

src/app/__tests__/client-pages.test.tsx

Lines changed: 115 additions & 182 deletions
Large diffs are not rendered by default.

src/app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { SiteFooter } from "@/components/layout/site-footer";
55
import { SiteHeader } from "@/components/layout/site-header";
66
import { QueryProvider } from "@/components/query-provider";
77
import { ThemeProvider } from "@/components/theme-provider";
8+
import { Toaster } from "@/components/ui/sonner";
89
import { AuthProvider } from "@/contexts/AuthContext";
910
import { cn } from "@/lib/utils";
10-
import { Toaster } from "@/components/ui/sonner";
1111

1212
export const metadata: Metadata = {
1313
title: "Mattis",

src/app/players/players-client.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ import { toast } from "sonner";
88
import { PageShell } from "@/components/layout/page-shell";
99
import { PlayerForm } from "@/components/PlayerForm";
1010
import { SectionHeader } from "@/components/section-header";
11-
import { Badge } from "@/components/ui/badge";
12-
import { Button } from "@/components/ui/button";
13-
import {
14-
Card,
15-
CardContent,
16-
CardDescription,
17-
CardHeader,
18-
CardTitle,
19-
} from "@/components/ui/card";
2011
import {
2112
AlertDialog,
2213
AlertDialogAction,
@@ -27,6 +18,15 @@ import {
2718
AlertDialogHeader,
2819
AlertDialogTitle,
2920
} from "@/components/ui/alert-dialog";
21+
import { Badge } from "@/components/ui/badge";
22+
import { Button } from "@/components/ui/button";
23+
import {
24+
Card,
25+
CardContent,
26+
CardDescription,
27+
CardHeader,
28+
CardTitle,
29+
} from "@/components/ui/card";
3030
import {
3131
Table,
3232
TableBody,

src/app/rounds/rounds-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
44
import { CalendarCheck, Trophy } from "lucide-react";
55
import { useRouter } from "next/navigation";
6-
import { useMemo, useState } from "react";
6+
import { useMemo } from "react";
77
import { toast } from "sonner";
88
import { FettmattisForm } from "@/components/FettmattisForm";
99
import { FettmattisTable } from "@/components/fettmattis-table";

src/components/__tests__/activity-tables.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe("Activity tables", () => {
9595
const deleteButton = await screen.findByRole("button", { name: "Slett" });
9696
fireEvent.click(deleteButton);
9797

98-
expect(screen.getByText(/Fjerne Fettmattis?/i)).toBeTruthy();
98+
expect(screen.getByText(/Slett denne runden?/i)).toBeTruthy();
9999
// Round confirmed by dialog;
100100
});
101101

src/components/fettmattis-table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"use client";
22

33
import { Fragment, useState } from "react";
4-
5-
import { Badge } from "@/components/ui/badge";
6-
import { Button } from "@/components/ui/button";
74
import {
85
AlertDialog,
96
AlertDialogAction,
@@ -14,6 +11,8 @@ import {
1411
AlertDialogHeader,
1512
AlertDialogTitle,
1613
} from "@/components/ui/alert-dialog";
14+
import { Badge } from "@/components/ui/badge";
15+
import { Button } from "@/components/ui/button";
1716
import {
1817
Table,
1918
TableBody,

src/components/rounds-table.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
"use client";
22

33
import { Fragment, useState } from "react";
4-
5-
import { Badge } from "@/components/ui/badge";
6-
import { Button } from "@/components/ui/button";
74
import {
85
AlertDialog,
96
AlertDialogAction,
@@ -14,6 +11,8 @@ import {
1411
AlertDialogHeader,
1512
AlertDialogTitle,
1613
} from "@/components/ui/alert-dialog";
14+
import { Badge } from "@/components/ui/badge";
15+
import { Button } from "@/components/ui/button";
1716
import {
1817
Table,
1918
TableBody,

src/components/ui/alert-dialog.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
"use client";
22

3-
import * as React from "react";
43
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
5-
6-
import { cn } from "@/lib/utils";
4+
import * as React from "react";
75
import { buttonVariants } from "@/components/ui/button";
6+
import { cn } from "@/lib/utils";
87

98
const AlertDialog = AlertDialogPrimitive.Root;
109

0 commit comments

Comments
 (0)