test: cover the units #295 listed as shipping untested - #319
Merged
Merged
Conversation
The second half of #295. Its first half — the two assertions that never ran — closed in #314; these are the units the branch shipped with no test at all, plus one assertion that could not fail. `scripts/gen_i18n.py` was the only script in `scripts/` with no test beside it. What it pins is the property #302 added: the command's exit code has to tell "wrote the key files" from "wrote nothing", and both halves of the `strict` flag — the boot path still preferring stale types to a failed start. `user_state` and `deriveState` are the same rule in two languages, because the edit page recomputes the status pill after a local change without a reload. Nothing held them together, so the first edit to either would have drifted them silently. They now share one six-row table, written out in both suites, and the Python side asserts the table covers every declared state. `PasswordInput`'s reveal toggle, `useLeaveGuard`, `Error.tsx`'s 403 branch and `file_storage`'s `SelectionFooter` and `showEmpty` had no tests. The two worth naming: - `useLeaveGuard` was stubbed out by both page suites (`router: { on: () => () => {} }`), so neither the prompt nor its escape hatch ran. The escape hatch is the load-bearing half: the page's own save is an Inertia visit too, and prompting on it would ask "discard your changes?" while saving them. - `showEmpty` keys on `pagination.total`, not `files.length`. A page past the last one renders an empty `files` array while the bucket is full, so the simpler condition would announce "No files yet" over a full bucket. Its copy also splits on whether a filter is active, because "No files yet" is wrong and discouraging when the filter is merely too narrow. `_clamp`'s out-of-range branch — zero, negative, `None`, a numeric string, and both bools, since `bool` is an `int` and `True` must not read as one second. And `test_remember_me.py`'s `if reissued is not None:` becomes an assertion. It let the test pass when the page wrote no session cookie at all, which is exactly the case where it has stopped exercising the regression. Closes #295
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Deploying simple-module-python with
|
| Latest commit: |
db5a103
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1560f82d.simple-module-python.pages.dev |
| Branch Preview URL: | https://fix-missing-unit-tests.simple-module-python.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #295 — the second half. The first half (the two assertions that never ran) closed in #314. Held until #312 and #313 landed, since both touch these files.
What was untested
scripts/gen_i18n.pyscripts/tests/test_gen_i18n.pyuser_state↔deriveStatemodules/users/tests/test_user_state.py+modules/users/tests-js/deriveState.test.tspackages/ui/…/PasswordInput.tsxPasswordInput.test.tsxhost/client_app/pages/Error.tsx(403 branch)Error.test.tsxuseLeaveGuardmodules/permissions/tests-js/useLeaveGuard.test.tsxfile_storageSelectionFooter/showEmptySelectionFooter.test.tsx+BrowseEmptyState.test.tsx_clampout-of-range branchtest_session_cookie_window.pyif reissued is not None:test_remember_me.pyThe three worth reading
user_state/deriveStateare the same rule in two languages —deriveStateexists because disabling an account from the edit page updates local state without a reload, so the pill has to be recomputed rather than read off the prop it was rendered from. Nothing held them together, so the first edit to either would have drifted them silently. They now share one six-row table written out in both suites, and the Python side asserts that table covers every value inUSER_STATES, so a new state added without a case is a failure rather than a gap.useLeaveGuardwas stubbed out by both page suites (router: { on: () => () => {} }), so neither the prompt nor its escape hatch ever ran. The escape hatch is the load-bearing half: the page's own save is an Inertia visit too, and prompting on it would ask "discard your changes?" while saving them.showEmptykeys onpagination.total, notfiles.length. A page past the last one renders an emptyfilesarray while the bucket is full, so the simpler condition would announce "No files yet" over a full bucket — there is a test for exactly that case. The copy also splits on whether a filter is active, because "No files yet" is wrong and discouraging when the filter is merely too narrow._clampgets its other branch: zero, negative,None, a numeric string, and both bools —boolis anint, soTruemust not read as a one-second window.Two corrections to the issue's text
modules/file_storage"has no*.test.tsxat all". No longer true — perf(file_storage): one scan, cached, for the browse screen's bucket totals #307 and fix(ui): give the shared components the behaviour their roles promise #313 addedFileTable.test.tsx,format.test.tsandupload-queue.test.ts. OnlySelectionFooterandshowEmptywere actually missing, and those are what this adds.PasswordStrengthis indeed already covered;PasswordInputwas the gap, as stated.Verification
uv run pytest -q— 2973 passed, 60 deselectednpx vitest run— 463 passed in 56 files (+46)ruff format/ruff check/ty check framework modules host/check_file_size.py— passnpx biome check .(344 files),npx tsc --noEmitonpackages/ui,host/client_app,modules/{users,permissions,file_storage},check_untranslated_strings.mjs— passNote:
tsc -p host/client_appneedsmake gen-pagesfirst —modules.generated.tsis generated and absent in a fresh worktree. Not a change here, but it bites anyone typechecking that workspace in isolation.