Say in TESTING.md how to unit-test component logic (import it, don't read the source)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Newbie friendliness
- 72/100
- Issue type
- Documentation
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript, markdown, react
- Domain
- documentation, testing
Research direction
Start with TESTING.md and add a short section on unit-testing component logic: move the logic into a file without React or MUI imports, as components/widgets/optionKeys.js does in #421. Read the two source-reading tests named in the issue, tests/unit/search-bar-call-sites.test.mjs and tests/unit/search-bar-extenders.test.mjs, to see the pattern being discouraged. Done when the section exists, points to e2e tests in tests/e2e/ for on-screen behavior, and the timing note about landing between course pushes is respected.
Written by the indexing model from the issue text.
Description
What's missing
TESTING.md doesn't say how to unit-test code that lives in a React component. The unit tests run with node --test, which can't load React or MUI, so recent PRs have worked around it by reading the component's source file as text and matching patterns in it:
- #421
tests/unit/search-bar-call-sites.test.mjscounts exactly fourkeyForLabel(...)calls inSearchBarExtensible.js. - #420
tests/unit/search-bar-extenders.test.mjschecks the source foropen={open}, and tests a copy ofshouldOfferExtendersinstead of the real one.
Tests like these fail when someone reorganizes the file without breaking anything, and they can pass when the behavior is broken (#420's did).
What to add
A short section in TESTING.md:
- Put logic you want to unit-test in a small file with no React or MUI imports, and import it in both the component and the test.
components/widgets/optionKeys.js(#421) is the example to follow. - Don't write unit tests that read a component's source code as text.
- Check what a component does on screen with an e2e test in
tests/e2e/.
Optionally, once this lands, remove the source-reading parts of the two tests above if they are still there.
Timing
This changes contributor-facing guidance, so it should land between course assignment pushes, with a heads-up to open PRs.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 18
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 30
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ReduxISU/Redux_GUI
-
Picking "Grover's Algorithm" on Unstructured Search is ignored: the solver name maps to SAT's Grover solverPossibly taken A pull request linked to this issue is open or already merged. Opengood first issue
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Make it clear the visualization shows the problem and the selected solverPossibly taken @Trosper3 claimed this 7 days ago. Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
ReduxISU/Redux_GUI#391 · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: Main page problem search shows no "Add new problem" button when nothing matchesPossibly taken @ShahadatTest claimed this 1 day ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
All issues in ReduxISU/Redux_GUI
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
riverqueue/river#1576 ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modrollstudio/Modroll-Studio-Website#80 · 1 comment ·
Maintainers usually reply within 1 day
-
good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
mafzalkalwardev/mailforge#21 ·
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 82/100
-
good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 82/100