Skip to content

Commit 7e2198e

Browse files
committed
feat: initial corpus — React monorepo with 4 cross-package bugs
Tier 3 e2e corpus for QuantCode autonomous agent testing. Bugs: - packages/utils/src/format/date.ts: formatDate produces US-style dates (Math.floor field ordering) - packages/ui/src/components/Button/Button.tsx: icon-only button aria-label not applied to DOM element - packages/ui/src/components/DataTable/DataTable.tsx: stale closure in sort handler - apps/web/src/lib/api.ts: imports useThrottle (renamed to useDebounce) Test infra: bunfig.toml preload for happy-dom, cleanup() in React tests
1 parent ff9b4a9 commit 7e2198e

7 files changed

Lines changed: 26 additions & 6 deletions

File tree

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules/
2+
bun.lock
3+
*.lock
4+
dist/
5+
.DS_Store

bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test]
2+
environment = "happy-dom"

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,18 @@
88
"apps/*"
99
],
1010
"scripts": {
11-
"test": "bun test --recursive",
11+
"test": "bun test packages/utils/test packages/ui/test apps/web/test --preload ./packages/ui/test/setup.ts",
1212
"typecheck": "tsc --noEmit"
1313
},
1414
"devDependencies": {
1515
"typescript": "^5.4.0",
1616
"bun-types": "latest",
1717
"@types/react": "^18.3.0",
1818
"react": "^18.3.0",
19-
"react-dom": "^18.3.0"
19+
"react-dom": "^18.3.0",
20+
"@testing-library/react": "^16.0.0",
21+
"@testing-library/jest-dom": "^6.4.0",
22+
"happy-dom": "^14.0.0",
23+
"@happy-dom/global-registrator": "^14.0.0"
2024
}
2125
}

packages/ui/bunfig.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test]
2+
preload = ["./test/setup.ts"]

packages/ui/test/Button.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
import { describe, test, expect } from "bun:test"
2-
import { render } from "@testing-library/react"
1+
import { describe, test, expect, afterEach } from "bun:test"
2+
import { render, cleanup } from "@testing-library/react"
33
import { Button } from "../src/components/Button/Button"
44
import React from "react"
55

66
describe("Button", () => {
7+
afterEach(() => cleanup())
8+
79
test("renders with text", () => {
810
const { getByText } = render(<Button>Click me</Button>)
911
expect(getByText("Click me")).toBeDefined()

packages/ui/test/DataTable.test.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { describe, test, expect } from "bun:test"
2-
import { render, fireEvent } from "@testing-library/react"
1+
import { describe, test, expect, afterEach } from "bun:test"
2+
import { render, fireEvent, cleanup } from "@testing-library/react"
33
import { DataTable } from "../src/components/DataTable/DataTable"
44
import React from "react"
55

@@ -15,6 +15,8 @@ const columns = [
1515
]
1616

1717
describe("DataTable", () => {
18+
afterEach(() => cleanup())
19+
1820
test("renders all rows", () => {
1921
const { getByText } = render(<DataTable data={data} columns={columns} />)
2022
expect(getByText("Alice")).toBeDefined()

packages/ui/test/setup.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Set up happy-dom for React component tests
2+
import { GlobalRegistrator } from "@happy-dom/global-registrator"
3+
GlobalRegistrator.register()

0 commit comments

Comments
 (0)