You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add formal test policy and reach 80% statement coverage
- Create CONTRIBUTING.md with formal test policy requiring tests for new functionality
- Add coverageThreshold (80% statements) to package.json Jest config
- Update CI workflow to run tests with --coverage
- Add/expand tests across 10 test files (1660 total tests, 80.75% coverage)
We welcome contributions! This document outlines the process for contributing to this project and the test requirements all contributions must meet.
4
+
5
+
## Getting Started
6
+
7
+
1.**Fork the repository**
8
+
2.**Create a feature branch**: `git checkout -b feature/amazing-feature`
9
+
3.**Make your changes** (see guidelines below)
10
+
4.**Ensure all tests pass**: `npm test -- --watchAll=false`
11
+
5.**Commit your changes**: `git commit -m 'Add amazing feature'`
12
+
6.**Push to the branch**: `git push origin feature/amazing-feature`
13
+
7.**Open a Pull Request**
14
+
15
+
## Test Policy
16
+
17
+
**As major new functionality is added, tests for the new functionality MUST be added to an automated test suite.** This is a hard requirement for all pull requests that introduce or modify behavior.
18
+
19
+
### What requires tests
20
+
21
+
-**New features and components**: Any new React component, hook, or utility function must have corresponding unit tests.
22
+
-**Bug fixes**: A regression test must accompany each bug fix to prevent recurrence.
23
+
-**New visual effects or overlays**: Effect creation functions must be tested for element creation, cleanup, and edge cases (disabled/undefined input).
24
+
-**New famous people utilities**: Any new mapping or parsing logic in `famousPeopleUtils` must be tested.
25
+
-**Data transformations**: Functions that transform, filter, or aggregate data must have tests covering expected inputs and edge cases.
26
+
27
+
### What does NOT require tests
28
+
29
+
-**Documentation-only changes**: Updates to README, CONTRIBUTING, or other markdown files.
30
+
-**CSS-only changes**: Pure styling changes with no logic.
31
+
-**Translation files**: Adding or updating locale JSON files in `src/locales/`.
32
+
-**Static data additions**: Adding entries to data arrays (e.g., a new person in `src/data/famousPeople/`) that use existing, already-tested code paths.
33
+
-**Asset additions**: Adding images, fonts, or other static assets.
34
+
35
+
### Test conventions
36
+
37
+
-**Directory structure**: All tests live in `src/__tests__/`, mirroring the source directory structure:
38
+
-`src/__tests__/components/` for component tests
39
+
-`src/__tests__/hooks/` for hook tests
40
+
-`src/__tests__/utils/` for utility tests
41
+
-`src/__tests__/overlays/` for overlay/visual effect tests
42
+
-**Test utilities**: Use `@testing-library/react` for component tests and `@testing-library/user-event` for user interaction simulation.
43
+
-**Mocking**: CRA enables `resetMocks` by default, so all `jest.fn()` mocks are automatically reset between tests. Module mocks (`jest.mock(...)`) must be declared at the top of the file, before imports of the mocked module.
44
+
-**Naming**: Test files should be named `<ModuleName>.test.ts` or `<ModuleName>.test.tsx`.
45
+
-**Coverage threshold**: The project enforces a minimum of 80% statement coverage in CI. Run `npm test -- --watchAll=false --coverage` locally to verify before submitting.
46
+
47
+
## Code Style
48
+
49
+
This project follows the [Create React App ESLint configuration](https://www.npmjs.com/package/eslint-config-react-app) with additional rules defined in `package.json`. TypeScript strict mode provides further enforcement. CI treats all ESLint warnings as errors (`CI=true`), so contributions must pass linting to be merged. Suppress intentional console statements with `// eslint-disable-next-line no-console`.
50
+
51
+
## Areas for Contribution
52
+
53
+
-**New vision conditions**: Add more realistic simulations
54
+
-**Additional famous people**: Expand the educational content
55
+
-**Accessibility improvements**: Enhance screen reader support
Copy file name to clipboardExpand all lines: readme.md
+1-22Lines changed: 1 addition & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -247,28 +247,7 @@ Deployed to **Cloudflare Pages** at [theblind.spot](https://theblind.spot). The
247
247
248
248
## Contributing
249
249
250
-
We welcome contributions! Here's how you can help:
251
-
252
-
1.**Fork the repository**
253
-
2.**Create a feature branch**: `git checkout -b feature/amazing-feature`
254
-
3.**Add tests** for new functionality or bug fixes in `src/__tests__/`
255
-
4.**Ensure all tests pass**: `npm test -- --watchAll=false`
256
-
5.**Commit your changes**: `git commit -m 'Add amazing feature'`
257
-
6.**Push to the branch**: `git push origin feature/amazing-feature`
258
-
7.**Open a Pull Request**
259
-
260
-
### Code Style
261
-
262
-
This project follows the [Create React App ESLint configuration](https://www.npmjs.com/package/eslint-config-react-app) with additional rules defined in `package.json`. TypeScript strict mode provides further enforcement. CI treats all ESLint warnings as errors, so contributions must pass linting to be merged.
263
-
264
-
### Areas for Contribution
265
-
266
-
-**New vision conditions**: Add more realistic simulations
267
-
-**Additional famous people**: Expand the educational content
268
-
-**Accessibility improvements**: Enhance screen reader support
-**New languages**: Add translation files for more locales
250
+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines, including our **test policy** requiring tests for all new functionality.
0 commit comments