Skip to content

test: add Jest test suite with 46 tests across contract utils, API routes, and components#29

Draft
Abuchtela with Copilot wants to merge 1 commit into
mainfrom
copilot/analyze-test-coverage
Draft

test: add Jest test suite with 46 tests across contract utils, API routes, and components#29
Abuchtela with Copilot wants to merge 1 commit into
mainfrom
copilot/analyze-test-coverage

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown

The codebase had zero test coverage — no framework, no test files, no test scripts.

Test infrastructure

  • Added jest, jest-environment-jsdom, @testing-library/react, @testing-library/jest-dom, @types/jest
  • jest.config.js via next/jest (SWC transform, @/ path alias, per-file environment overrides)
  • jest.setup.ts loads jest-dom matchers
  • test and test:coverage scripts in package.json

Test suites

Suite Tests Focus
__tests__/lib/contract.test.ts 16 All 6 exported functions; mocks fetch for getCurrentDelegation error and success paths
__tests__/api/delegation-example.test.ts 12 POST handler actions (delegate, undelegate, unknown); isValidAddress edge cases (too short/long, non-hex, mixed-case); malformed body → 500
__tests__/api/frame-image.test.ts 10 GET handler status/headers; SVG structure; all 4 action variants; unknown action fallback; delegate address interpolation
__tests__/components/GridCard.test.tsx 8 handleStatus for all 6 execution-status values plus empty string and unknown value

API route tests use @jest-environment node to get the Web Fetch API Request available in the Node.js runtime (required by NextRequest); component tests use the default jsdom environment.

@codesandbox

codesandbox Bot commented May 21, 2026

Copy link
Copy Markdown

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@vercel

vercel Bot commented May 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ecosystem-contributions Ready Ready Preview, Comment May 21, 2026 2:09am

@google-cla

google-cla Bot commented May 21, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants