| Dimension | Shared | Only in A | Only in B | Overlap |
|---|---|---|---|---|
| Sections | 0 | 5 | 10 | 0% |
| Commands | 0 | 0 | 5 | 0% |
| Section tags | 0 | 0 | 5 | 0% |
What each file covers
Sections
0 shared · 5 only in A · 10 only in B- − Core Directives & Hierarchy
- − General Interaction & Philosophy
- − Minimalist & Standard Code Generation
- − Surgical Code Modification
- − Intelligent Tool Usage
- + Testing Conventions
- + Testing Stack
- + Test File Organization
- + Testing Patterns
- + Frontend Component Tests
- + Backend API Tests
- + E2E Tests
- + Test Configuration
- + Running Tests
- + Best Practices
Commands
0 shared · 0 only in A · 5 only in B- + yarn test
- + yarn test:watch
- + yarn test:coverage
- + yarn e2e
- + yarn e2e:dev
Section tags
0 shared · 0 only in A · 5 only in B- + test
- + code-style
- + testing-strategy
- + api
- + ui
Line diff
magdazelena/primer · .cursor/rules/agents.mdc
@@ −1 @@
1---
2alwaysApply: true
3description: Prevent cursor from going haywire
4---
5
6## Core Directives & Hierarchy
7
8This section outlines the absolute order of operations. These rules have the highest priority and must not be violated.
9
101. **Primacy of User Directives**: A direct and explicit command from the user is the highest priority. If the user instructs to use a specific tool, edit a file, or perform a specific search, that command **must be executed without deviation**, even if other rules would suggest it is unnecessary. All other instructions are subordinate to a direct user order.
112. **Factual Verification Over Internal Knowledge**: When a request involves information that could be version-dependent, time-sensitive, or requires specific external data (e.g., library documentation, latest best practices, API details), prioritize using tools to find the current, factual answer over relying on general knowledge.
123. **Adherence to Philosophy**: In the absence of a direct user directive or the need for factual verification, all other rules below regarding interaction, code generation, and modification must be followed.
13
14## General Interaction & Philosophy
15
16- **Code on Request Only**: Your default response should be a clear, natural language explanation. Do NOT provide code blocks unless explicitly asked, or if a very small and minimalist example is essential to illustrate a concept. Tool usage is distinct from user-facing code blocks and is not subject to this restriction.
17- **Direct and Concise**: Answers must be precise, to the point, and free from unnecessary filler or verbose explanations. Get straight to the solution without "beating around the bush".
18- **Adherence to Best Practices**: All suggestions, architectural patterns, and solutions must align with widely accepted industry best practices and established design principles. Avoid experimental, obscure, or overly "creative" approaches. Stick to what is proven and reliable.
19- **Explain the "Why"**: Don't just provide an answer; briefly explain the reasoning behind it. Why is this the standard approach? What specific problem does this pattern solve? This context is more valuable than the solution itself.
20
21## Minimalist & Standard Code Generation
22
23- **Principle of Simplicity**: Always provide the most straightforward and minimalist solution possible. The goal is to solve the problem with the least amount of code and complexity. Avoid premature optimization or over-engineering.
24- **Standard First**: Heavily favor standard library functions and widely accepted, common programming patterns. Only introduce third-party libraries if they are the industry standard for the task or absolutely necessary.
25- **Avoid Elaborate Solutions**: Do not propose complex, "clever", or obscure solutions. Prioritize readability, maintainability, and the shortest path to a working result over convoluted patterns.
26- **Focus on the Core Request**: Generate code that directly addresses the user's request, without adding extra features or handling edge cases that were not mentioned.
27
28## Surgical Code Modification
29
30- **Preserve Existing Code**: The current codebase is the source of truth and must be respected. Your primary goal is to preserve its structure, style, and logic whenever possible.
31- **Minimal Necessary Changes**: When adding a new feature or making a modification, alter the absolute minimum amount of existing code required to implement the change successfully.
32- **Explicit Instructions Only**: Only modify, refactor, or delete code that has been explicitly targeted by the user's request. Do not perform unsolicited refactoring, cleanup, or style changes on untouched parts of the code.
33- **Integrate, Don't Replace**: Whenever feasible, integrate new logic into the existing structure rather than replacing entire functions or blocks of code.
34
35## Intelligent Tool Usage
36
37- **Use Tools When Necessary**: When a request requires external information or direct interaction with the environment, use the available tools to accomplish the task. Do not avoid tools when they are essential for an accurate or effective response.
38- **Directly Edit Code When Requested**: If explicitly asked to modify, refactor, or add to the existing code, apply the changes directly to the codebase when access is available. Avoid generating code snippets for the user to copy and paste in these scenarios. The default should be direct, surgical modification as instructed.
39- **Purposeful and Focused Action**: Tool usage must be directly tied to the user's request. Do not perform unrelated searches or modifications. Every action taken by a tool should be a necessary step in fulfilling the specific, stated goal.
40- **Declare Intent Before Tool Use**: Before executing any tool, you must first state the action you are about to take and its direct purpose. This statement must be concise and immediately precede the tool call.
magdazelena/primer · .cursor/rules/testing-conventions.mdc
@@ +1 @@
1---
2globs: **/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx,**/*.cy.ts
3---
4
5# Testing Conventions
6
7## Testing Stack
8
9- **Unit Tests**: Jest with React Testing Library
10- **E2E Tests**: Cypress
11- **Backend Tests**: Jest with Strapi testing utilities
12- **Coverage**: Istanbul for coverage reporting
13
14## Test File Organization
15
16- **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/)
19
20## Testing Patterns
21
22### Frontend Component Tests
23
24```typescript
25import { render, screen } from '@testing-library/react';
26import { Button } from './Button';
27
28describe('Button', () => {
29 it('renders with correct text', () => {
30 render(<Button>Click me</Button>);
31 expect(screen.getByText('Click me')).toBeInTheDocument();
32 });
33});
34```
35
36### Backend API Tests
37
38```typescript
39import { createStrapiInstance } from '@strapi/strapi';
40
41describe('Product API', () => {
42 let strapi: StrapiInstance;
43
44 beforeAll(async () => {
45 strapi = await createStrapiInstance();
46 });
47
48 afterAll(async () => {
49 await strapi.destroy();
50 });
51});
52```
53
54### E2E Tests
55
56```typescript
57describe('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```
64
65## Test Configuration
66
67- **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)
70
71## Running Tests
72
73- `yarn test` - Run all tests
74- `yarn test:watch` - Watch mode
75- `yarn test:coverage` - With coverage
76- `yarn e2e` - Run Cypress tests
77- `yarn e2e:dev` - Open Cypress UI
78
79## Best Practices
80
81- Use `data-testid` attributes for reliable element selection
82- Mock external dependencies
83- Test user interactions, not implementation details
84- Keep tests focused and independent
85- Use descriptive test names
@@ −1 +1 @@
11 ---
2−alwaysApply: true
3−description: Prevent cursor from going haywire
2+globs: **/*.test.ts,**/*.test.tsx,**/*.spec.ts,**/*.spec.tsx,**/*.cy.ts
43 ---
54
6−## Core Directives & Hierarchy
5+# Testing Conventions
76
8−This section outlines the absolute order of operations. These rules have the highest priority and must not be violated.
7+## Testing Stack
98
10−1. **Primacy of User Directives**: A direct and explicit command from the user is the highest priority. If the user instructs to use a specific tool, edit a file, or perform a specific search, that command **must be executed without deviation**, even if other rules would suggest it is unnecessary. All other instructions are subordinate to a direct user order.
11−2. **Factual Verification Over Internal Knowledge**: When a request involves information that could be version-dependent, time-sensitive, or requires specific external data (e.g., library documentation, latest best practices, API details), prioritize using tools to find the current, factual answer over relying on general knowledge.
12−3. **Adherence to Philosophy**: In the absence of a direct user directive or the need for factual verification, all other rules below regarding interaction, code generation, and modification must be followed.
9+- **Unit Tests**: Jest with React Testing Library
10+- **E2E Tests**: Cypress
11+- **Backend Tests**: Jest with Strapi testing utilities
12+- **Coverage**: Istanbul for coverage reporting
1313
14−## General Interaction & Philosophy
14+## Test File Organization
1515
16−- **Code on Request Only**: Your default response should be a clear, natural language explanation. Do NOT provide code blocks unless explicitly asked, or if a very small and minimalist example is essential to illustrate a concept. Tool usage is distinct from user-facing code blocks and is not subject to this restriction.
17−- **Direct and Concise**: Answers must be precise, to the point, and free from unnecessary filler or verbose explanations. Get straight to the solution without "beating around the bush".
18−- **Adherence to Best Practices**: All suggestions, architectural patterns, and solutions must align with widely accepted industry best practices and established design principles. Avoid experimental, obscure, or overly "creative" approaches. Stick to what is proven and reliable.
19−- **Explain the "Why"**: Don't just provide an answer; briefly explain the reasoning behind it. Why is this the standard approach? What specific problem does this pattern solve? This context is more valuable than the solution itself.
16+- **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/)
2019
21−## Minimalist & Standard Code Generation
20+## Testing Patterns
2221
23−- **Principle of Simplicity**: Always provide the most straightforward and minimalist solution possible. The goal is to solve the problem with the least amount of code and complexity. Avoid premature optimization or over-engineering.
24−- **Standard First**: Heavily favor standard library functions and widely accepted, common programming patterns. Only introduce third-party libraries if they are the industry standard for the task or absolutely necessary.
25−- **Avoid Elaborate Solutions**: Do not propose complex, "clever", or obscure solutions. Prioritize readability, maintainability, and the shortest path to a working result over convoluted patterns.
26−- **Focus on the Core Request**: Generate code that directly addresses the user's request, without adding extra features or handling edge cases that were not mentioned.
22+### Frontend Component Tests
2723
28−## Surgical Code Modification
24+```typescript
25+import { render, screen } from '@testing-library/react';
26+import { Button } from './Button';
2927
30−- **Preserve Existing Code**: The current codebase is the source of truth and must be respected. Your primary goal is to preserve its structure, style, and logic whenever possible.
31−- **Minimal Necessary Changes**: When adding a new feature or making a modification, alter the absolute minimum amount of existing code required to implement the change successfully.
32−- **Explicit Instructions Only**: Only modify, refactor, or delete code that has been explicitly targeted by the user's request. Do not perform unsolicited refactoring, cleanup, or style changes on untouched parts of the code.
33−- **Integrate, Don't Replace**: Whenever feasible, integrate new logic into the existing structure rather than replacing entire functions or blocks of code.
28+describe('Button', () => {
29+ it('renders with correct text', () => {
30+ render(<Button>Click me</Button>);
31+ expect(screen.getByText('Click me')).toBeInTheDocument();
32+ });
33+});
34+```
3435
35−## Intelligent Tool Usage
36+### Backend API Tests
3637
37−- **Use Tools When Necessary**: When a request requires external information or direct interaction with the environment, use the available tools to accomplish the task. Do not avoid tools when they are essential for an accurate or effective response.
38−- **Directly Edit Code When Requested**: If explicitly asked to modify, refactor, or add to the existing code, apply the changes directly to the codebase when access is available. Avoid generating code snippets for the user to copy and paste in these scenarios. The default should be direct, surgical modification as instructed.
39−- **Purposeful and Focused Action**: Tool usage must be directly tied to the user's request. Do not perform unrelated searches or modifications. Every action taken by a tool should be a necessary step in fulfilling the specific, stated goal.
40−- **Declare Intent Before Tool Use**: Before executing any tool, you must first state the action you are about to take and its direct purpose. This statement must be concise and immediately precede the tool call.
38+```typescript
39+import { createStrapiInstance } from '@strapi/strapi';
40+
41+describe('Product API', () => {
42+ let strapi: StrapiInstance;
43+
44+ beforeAll(async () => {
45+ strapi = await createStrapiInstance();
46+ });
47+
48+ afterAll(async () => {
49+ await strapi.destroy();
50+ });
51+});
52+```
53+
54+### E2E Tests
55+
56+```typescript
57+describe('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+```
64+
65+## Test Configuration
66+
67+- **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)
70+
71+## Running Tests
72+
73+- `yarn test` - Run all tests
74+- `yarn test:watch` - Watch mode
75+- `yarn test:coverage` - With coverage
76+- `yarn e2e` - Run Cypress tests
77+- `yarn e2e:dev` - Open Cypress UI
78+
79+## Best Practices
80+
81+- Use `data-testid` attributes for reliable element selection
82+- Mock external dependencies
83+- Test user interactions, not implementation details
84+- Keep tests focused and independent
85+- Use descriptive test names
