Tests: Missing direct unit test coverage for isHandle() in wporg-handle.cjs
Nobody has claimed this yet.
Assessment
- Difficulty
- 1/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 92/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- javascript
- Domain
- testing
Research direction
Start in src/wporg-handle.cjs to inspect the exported isHandle(value), then open tests/unit/wporg-handle.test.cjs and follow the existing parseHandle and handoffFilename test style. Import isHandle directly, cover the listed valid and invalid inputs plus length boundaries, and run the unit test file to confirm the complete contract is exercised.
Written by the indexing model from the issue text.
Description
Description
src/wporg-handle.cjs exports isHandle(value) to determine whether a value is already a canonical WordPress.org handle before using it in structural positions (such as patch filenames in src/patch-provenance.cjs).
Currently, tests/unit/wporg-handle.test.cjs does not import or test isHandle(value) directly. While parseHandle and handoffFilename have test coverage, isHandle itself lacks dedicated unit tests verifying its exact contract:
- Valid canonical handles (letters, digits, valid internal separators
_,-,.). - Strict lowercase requirement (
JaneDoemust returnfalse). - Length boundaries (
MAX_HANDLE_LENGTH = 60returnstrue,61returnsfalse). - Refusal of leading/trailing separators (
-janedoe,janedoe-,.janedoe,janedoe_). - Refusal of invalid characters (spaces, slashes, path traversal, newlines,
#). - Refusal of non-string or empty inputs (
null,undefined, numbers, objects, arrays, empty strings).
Proposed Solution
Add dedicated unit tests in tests/unit/wporg-handle.test.cjs to cover all criteria of isHandle().
- Dominant language
- JavaScript
- Stars
- 36
- Forks
- 13
- Avg merge
- 14h 42m
- Merged PRs (30d)
- 70
Contributor 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 WordPress/contributor-toolkit
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
WordPress/contributor-toolkit#478 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
WordPress/contributor-toolkit#474 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
WordPress/contributor-toolkit#374 · 1 comment ·
-
Start dev server and Start build watch are reachable while a build is running outside the wizard Openbug
Difficulty 4/5 3-5 days Newbie friendliness 62/100
WordPress/contributor-toolkit#503 ·
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 78/100
WordPress/contributor-toolkit#501 ·
All issues in WordPress/contributor-toolkit
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
HarperFast/skills#96 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
sugarlabs/musicblocks#8847 ·
-
client-controller-update ta-bot-triage team-money-movement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
MetaMask/metamask-mobile#36594 ·