Skip to content

Add AI instructions for repo guidelines and testing best practises#479

Merged
aurorascharff merged 14 commits intomainfrom
refactor-tests
Feb 19, 2026
Merged

Add AI instructions for repo guidelines and testing best practises#479
aurorascharff merged 14 commits intomainfrom
refactor-tests

Conversation

@aurorascharff
Copy link
Copy Markdown
Contributor

Describe your changes

Add AI instructions and rewrite all tests to be best practise

Checklist before requesting a review

  • I have performed a self-review and test of my code
  • I have added label to the PR (major, minor or patch)
  • If applicable: Is story created/updated in stories-folder?
  • If applicable: Is README-file for CSS documentation created/updated?
  • If applicable: Are unit tests created/updated for the component?
  • If new component: Is tsx-file import added to packages/react/index.tsx?
  • If new component: Is CSS-file added to packages/css/index.css?

@aurorascharff aurorascharff added the dependencies Pull requests that update a dependency file label Feb 18, 2026
@aurorascharff aurorascharff changed the title Add AI instructions and rewrite all tests to be best practise Add AI instructions for repo guidelines and testing best practises Feb 18, 2026
@aurorascharff aurorascharff marked this pull request as ready for review February 19, 2026 10:06
@aurorascharff aurorascharff requested a review from a team as a code owner February 19, 2026 10:06
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive AI agent instructions and refactors tests to follow accessibility-first best practices. It adds the AGENTS.md file with detailed guidelines for AI assistants working on this React component library, updates the README to reference these guidelines, and rewrites test files to use accessible queries (getByRole, getByLabelText) instead of less accessible alternatives.

Changes:

  • Added AGENTS.md with comprehensive testing best practices, component guidelines, and accessibility requirements
  • Refactored test files to use accessible queries (getByRole over getByLabelText, screen.getByTestId over container.querySelector)
  • Enhanced test assertions to always include toHaveBeenCalledTimes before toHaveBeenCalledWith
  • Updated TypeScript configuration to include Vitest globals and jest-dom types

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
AGENTS.md New comprehensive guide for AI agents with testing best practices, folder structure, accessibility requirements, and PR guidelines
.github/copilot-instructions.md Simple reference file pointing to AGENTS.md for GitHub Copilot integration
README.md Added AI-verktøy section documenting the new AI agent instructions and testing best practices note
packages/react/tsconfig.json Added Vitest globals and jest-dom types for proper TypeScript support
packages/react/src/pagination/tests/MdPagination.test.tsx Refactored to use getByRole('button') with name option, added toHaveBeenCalledTimes assertions, improved test descriptions
packages/react/src/formElements/tests/MdRadioGroup.test.tsx Replaced container.querySelector with screen.getByTestId for consistency
packages/react/src/formElements/tests/MdCheckboxGroup.test.tsx Replaced container.querySelector with screen.getByTestId for consistency
packages/react/src/accordion/tests/MdAccordion.test.tsx Replaced container.querySelector with screen.getByTestId for consistency

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@aurorascharff aurorascharff merged commit 087eb1d into main Feb 19, 2026
10 of 11 checks passed
@aurorascharff aurorascharff deleted the refactor-tests branch February 19, 2026 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants