Cursor rule
.cursor/rules/testing-conventions.mdcCursor rules
Quality
73/100
Scores the file, not the repository.Length
236 words
10 headings · 3 code blocksRepository
3
— · pushed 158 days agoLast changed
3 days ago
First indexed 3 days ago.12345# Testing Conventions67## Testing Stack89- **Unit Tests**: Jest with React Testing Library10- **E2E Tests**: Cypress11- **Backend Tests**: Jest with Strapi testing utilities12- **Coverage**: Istanbul for coverage reporting1314## Test File Organization1516- **Unit Tests**: `*.test.ts` or `*.test.tsx`17- **E2E Tests**: `*.cy.ts` in [apps/frontend/cypress/e2e/](mdc:apps/frontend/cypress/e2e/)18- **Fixtures**: Test data in [apps/frontend/cypress/fixtures/](mdc:apps/frontend/cypress/fixtures/)1920## Testing Patterns2122### Frontend Component Tests2324```typescript25import { render, screen } from '@testing-library/react';26import { Button } from './Button';2728describe('Button', () => {29 it('renders with correct text', () => {30 render(<Button>Click me</Button>);31 expect(screen.getByText('Click me')).toBeInTheDocument();32 });33});34```3536### Backend API Tests3738```typescript39import { createStrapiInstance } from '@strapi/strapi';4041describe('Product API', () => {42 let strapi: StrapiInstance;4344 beforeAll(async () => {45 strapi = await createStrapiInstance();46 });4748 afterAll(async () => {49 await strapi.destroy();50 });51});52```5354### E2E Tests5556```typescript57describe('Product Series', () => {58 it('should display product series page', () => {59 cy.visit('/en/product-series');60 cy.get('[data-testid="product-series"]').should('be.visible');61 });62});63```6465## Test Configuration6667- **Jest Config**: [apps/frontend/jest.config.ts](mdc:apps/frontend/jest.config.ts)68- **Cypress Config**: [apps/frontend/cypress.config.ts](mdc:apps/frontend/cypress.config.ts)69- **Setup Files**: [apps/frontend/jest.setup.ts](mdc:apps/frontend/jest.setup.ts)7071## Running Tests7273- `yarn test` - Run all tests74- `yarn test:watch` - Watch mode75- `yarn test:coverage` - With coverage76- `yarn e2e` - Run Cypress tests77- `yarn e2e:dev` - Open Cypress UI7879## Best Practices8081- Use `data-testid` attributes for reliable element selection82- Mock external dependencies83- Test user interactions, not implementation details84- Keep tests focused and independent85- Use descriptive test names
Also in magdazelena/primer
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| magdazelena/primer.cursor/rules/agents.mdc · 3 | Cursor rules | no sections | 48/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/code-quality.mdc · 3 | Cursor rules | lint-formatstyletypesperformance+2 | 73/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/memory.mdc · 3 | Cursor rules | styleperformancedo-notagent-behaviour | 61/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/monorepo-management.mdc · 3 | Cursor rules | buildtestlint-formatstyle+5 | 79/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/nextjs-frontend.mdc · 3 | Cursor rules | teststylearchapi+1 | 72/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/project-structure.mdc · 3 | Cursor rules | testlint-formatarchmonorepo | 71/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/strapi-backend.mdc · 3 | Cursor rules | stylearchtypesdatabase | 68/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/strapi-plugin-development.mdc · 3 | Cursor rules | buildtestarchagent-behaviour | 85/100 | 3 days ago | |
| magdazelena/primer.cursor/rules/typescript-conventions.mdc · 3 | Cursor rules | lint-formatstyletypesdo-not | 65/100 | 3 days ago |
Diff against .cursor/rules/agents.mdc Diff against .cursor/rules/code-quality.mdc Diff against .cursor/rules/memory.mdc Diff against .cursor/rules/monorepo-management.mdc Diff against .cursor/rules/nextjs-frontend.mdc Diff against .cursor/rules/project-structure.mdc Diff against .cursor/rules/strapi-backend.mdc Diff against .cursor/rules/strapi-plugin-development.mdc Diff against .cursor/rules/typescript-conventions.mdc
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 45 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 3 days ago | |
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 3 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 3 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 3 days ago | |
| TechSquidTV/Hermes.cursor/rules/20-hermes-api-tests.mdc · 45 | Cursor rules | teststyletesting-strategysecurity+3 | 97/100 | 3 days ago |
