-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy path.coderabbit.yaml
More file actions
85 lines (72 loc) 路 2.94 KB
/
Copy path.coderabbit.yaml
File metadata and controls
85 lines (72 loc) 路 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: 'ko-KR'
early_access: false
reviews:
profile: 'chill'
request_changes_workflow: false
high_level_summary: true
poem: false
review_status: true
collapse_walkthrough: false
finishing_touches:
unit_tests:
enabled: true
auto_review:
enabled: true
drafts: false
base_branches:
- 'main'
- 'feature/*'
- 'fix/*'
- 'v*'
chat:
auto_reply: true
code_generation:
unit_tests:
path_instructions:
- path: 'packages/wds/**/*.tsx'
instructions: |
Please write unit tests for the following code.
## Unit Test Guidelines
### For Logic Changes
- Write tests in `packages/wds/src/components/{ComponentName}/index.test.tsx`
- Group related test cases using `describe` blocks to describe specific scenarios/contexts
- Include accessibility (a11y) tests when applicable using testing-library's accessibility utilities
- All test case descriptions must be written in English
### For UI/Visual Changes
- Write visual test fixtures in `tests/visual/src/fixtures/{component-name}.tsx`
### Test Structure Example For Logic Changes
- Refer to `packages/wds/src/components/date-calendar/index.test.tsx` for proper test organization and best practices.
- Group related test cases using `describe` blocks to describe specific scenarios/contexts.
- Use `beforeEach` and `afterEach` hooks for setup and cleanup, such as resetting mocks and cleaning up the rendered DOM.
- Use `it` blocks with clear, English descriptions for each test case.
- Example (based on `date-calendar` tests):
```tsx
describe('when given DateCalendar component', () => {
const defaultProps = {
defaultValue: new Date('2025-01-01T10:00:00'),
onChange: vi.fn(),
locale: 'en-US',
};
beforeEach(() => {
vi.clearAllMocks();
});
afterEach(() => {
cleanup();
});
it('should handle date selection', () => {
const onChange = vi.fn();
render(<DateCalendar {...defaultProps} onChange={onChange} />);
const dateButton = screen.getByText('15');
fireEvent.click(dateButton);
expect(onChange).toHaveBeenCalledWith(expect.any(Date));
});
// Add more test cases as needed
it('should pass accessibility tests', async () => {
const { rerender } = render(<DateCalendar {...defaultProps} />);
expect(await axe(screen.getByRole('rowgroup'))).toHaveNoViolations();
// Additional accessibility assertions...
});
});
```
- Be sure to include accessibility and edge case tests where applicable.