test(bulletin): add unit test for getPageItems pagination - #348
Merged
Conversation
5 tasks
andrecamerino
force-pushed
the
test/182-first-unit-test
branch
from
September 2, 2026 13:47
eed9a59 to
897b5ea
Compare
andrecamerino
changed the base branch from
test/182-set-up-vitest
to
ci/wire-up-test-workflow
September 2, 2026 13:48
andrecamerino
force-pushed
the
test/182-first-unit-test
branch
from
September 2, 2026 14:23
897b5ea to
6823f28
Compare
andrecamerino
force-pushed
the
test/182-first-unit-test
branch
from
September 2, 2026 14:30
6823f28 to
27541cd
Compare
andrecamerino
force-pushed
the
test/182-first-unit-test
branch
from
September 3, 2026 14:35
27541cd to
96eea47
Compare
andrecamerino
marked this pull request as ready for review
September 3, 2026 14:49
evanautianle
approved these changes
Sep 4, 2026
evanautianle
left a comment
Collaborator
There was a problem hiding this comment.
yurrrrpppp looks good great work andre
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.
Description
Adds this repo's first real unit test, proving the Vitest/RTL setup from #347 actually works end to end. This is PR 3 of a 4-part stack (base:
ci/wire-up-test-workflow):Target:
getPageItems(src/components/bulletin/AllArticles.tsx) - the pagination-window algorithm that turns(totalPages, currentPage)into the list of page numbers/ellipses the pager renders. It's a plain function (no rendering, no DB), so this is a pure "unit test" - deterministic and isolated, deliberately picked over a trivial formatter since it has real branching logic worth locking down (short vs. long page lists, ellipsis placement on either/both sides).Changes:
exporttogetPageItemsand theELLIPSISconst it returns - previously module-private, no behavior change.src/components/bulletin/AllArticles.test.tsx, colocated with the component it covers, with a comment noting that convention (test file next to source,*.test.ts(x)) for future contributors. Covers: all-pages-shown for small totals, single-page, windowing with ellipsis on both/one/neither side.Part of #182 (satisfies the "sample test file exists" AC item)
Note
Because #352 (CI wiring) now sits below this PR in the stack, this PR's own CI run actually exercises the
testjob against these tests - not just localpnpm testoutput.Decisions
tests/- this test is tied to one specific file, so it lives next to it.tests/is reserved for cross-cutting concerns (setup helpers, things that don't belong to a single source file).AI Usage
Type of change
How Has This Been Tested?
npm run lintandnpm run buildpass locallypnpm test(5/5 passing),pnpm lint, andpnpm format:checkwere run locally and pass clean.pnpm buildwas not run locally in this session (no local DB/env configured) - CI'sBuildjob will verify it.