tangled
alpha
login
or
join now
tylur.dev
/
prototypey
prototypey.org - atproto lexicon typescript toolkit - mirror https://github.com/tylersayshi/prototypey
1
fork
atom
overview
issues
pulls
pipelines
tests work with mocked nuqs
Tyler
3 months ago
f443d318
b50fda4c
+13
-3
1 changed file
expand all
collapse all
unified
split
packages
site
tests
components
Playground.test.tsx
+13
-3
packages/site/tests/components/Playground.test.tsx
···
1
1
import { describe, it, expect, vi } from "vitest";
2
2
import { render, screen, waitFor } from "@testing-library/react";
3
3
import { Playground } from "../../src/components/Playground";
4
4
+
import { NuqsTestingAdapter } from "nuqs/adapters/testing";
4
5
5
6
vi.mock("@monaco-editor/react", () => ({
6
7
default: ({ value, onChange }: any) => (
···
60
61
},
61
62
}));
62
63
64
64
+
// Helper function to render Playground with NuqsTestingAdapter
65
65
+
function renderPlayground() {
66
66
+
return render(<Playground />, {
67
67
+
wrapper: ({ children }) => (
68
68
+
<NuqsTestingAdapter searchParams="">{children}</NuqsTestingAdapter>
69
69
+
),
70
70
+
});
71
71
+
}
72
72
+
63
73
describe("Playground", () => {
64
74
it("renders Editor and OutputPanel components", async () => {
65
65
-
render(<Playground />);
75
75
+
renderPlayground();
66
76
67
77
expect(screen.getByText("Input")).toBeInTheDocument();
68
78
expect(screen.getByText("Output")).toBeInTheDocument();
···
74
84
});
75
85
76
86
it("starts with default code in editor", async () => {
77
77
-
render(<Playground />);
87
87
+
renderPlayground();
78
88
79
89
// Wait for editors to be ready
80
90
await waitFor(() => {
···
88
98
});
89
99
90
100
it("evaluates code and displays output", async () => {
91
91
-
render(<Playground />);
101
101
+
renderPlayground();
92
102
93
103
await waitFor(
94
104
() => {