test(input-mapper): add captureKey tests for all mapped keys #14294

Merged
Bhupinder0x01 merged 2 commits from upstream-pr/14294 into main 2026-11-09 18:50:09 +00:00
Bhupinder0x01 commented 2026-11-01 06:59:29 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Bhupinder0x01 on 2026-11-01T06:59:29Z.


What

Add comprehensive test coverage for the captureKey function in capture.js, testing all letter keys, digit keys, numpad keys, function keys, and special keys that are mapped to SDL key names. Also tests error cases for composition/dead keys, non-exportable keys, and out-of-range keys.

Tested

Node.js tests pass (run with node --test tests/*.test.js in tools/input-mapper).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: #11860
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5105196522 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14294). Originally posted by [Bhupinder0x01](https://github.com/Bhupinder0x01) on 2026-11-01T06:59:29Z. --- ### What Add comprehensive test coverage for the captureKey function in capture.js, testing all letter keys, digit keys, numpad keys, function keys, and special keys that are mapped to SDL key names. Also tests error cases for composition/dead keys, non-exportable keys, and out-of-range keys. ### Tested Node.js tests pass (run with `node --test tests/*.test.js` in tools/input-mapper). ### Checklist - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except technical debt - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's technical debt file - [x] No notes, investigation .md files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: #11860 - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
MarcZX10 commented 2026-11-02 06:35:11 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T06:35:11Z.

Review: COMMENTED


Reviewed — no blocking findings

This adds JavaScript tests for captureKey: the letters, digits, numpad, function, punctuation, navigation and modifier keys, and the rejection of F25 and Numpad10. I checked every expected value against the mapping in capture.js and against the keyNames list in keys.js, and the expectations match both. No test has run on this head: the Build and Input mapper workflow runs are waiting for maintainer approval (action_required).

What I ran

  • Head 29a01b1942c51d536910aeaeb6e8796d3c2f697b; base b41526345185943c53af0c6eee97863df4389c9e. 1 file, +35: tools/input-mapper/tests/mapping.test.js (two new tests).
  • Read the two new tests in full. Read captureKey in tools/input-mapper/capture.js, its rules for letters, digits, numpad digits, F1 to F24, and the mapping table. Read the keyNames list in tools/input-mapper/keys.js.
  • Checked the 101 expected value pairs of the first new test against keyNames: all 101 are present. The rules give the same values as the test for every code the test lists. The F25 and Numpad10 cases are rejected by the rules as the second test expects.
  • Hosted: the Build and Input mapper workflow runs for this head are action_required (they wait for approval). The Conventions and PR labels runs passed. No run of npm --prefix tools/input-mapper test exists for this head.
  • Read-only checks from the trusted main checkout: diff check, conventions and PR template, and the stack check all passed. The ABI audit is not applicable. No PR-head JavaScript was run here.
  • No MarcZX10 review at this head.

Results

Check Result Note
Diff check passed
Conventions and PR template passed conventions check from the main checkout
Mergeability and dependencies passed stack check passed; no declared dependencies
Expected values in the first test are in keyNames passed by reading 101 of 101 pairs present
Expected values follow the rules in captureKey passed by reading letters, digits, numpad, F1 to F24, the mapping table
Out-of-range function and numpad keys are rejected passed by reading F25 and Numpad10 take no matching rule
The tests pass not run no run of npm test for this head; Input mapper is waiting for approval
ABI audit not applicable no export changed
Negative controls not run no local run
Hosted CI not run Build and Input mapper are action_required; Conventions and PR labels passed
Read-only check output

Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: passed. Hosted: gh api repos/boykopovar/AnyPS5/actions/runs?head_sha=29a01b1942c51d536910aeaeb6e8796d3c2f697b (the Build and Input mapper runs are action_required).

Negative control

Not run here. A negative control needs a local run of the test, and the PR's JavaScript is not run here.

Findings

Blocking

None.

Non-blocking

None.

Sources

Not verified

  • That npm test passes on this head (it has not run).

To get this to a good state

  • A maintainer approves the Input mapper run so that the test runs on this head.
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732861876 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/14294#pullrequestreview-5732861876). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T06:35:11Z. **Review:** COMMENTED --- # Reviewed — no blocking findings This adds JavaScript tests for `captureKey`: the letters, digits, numpad, function, punctuation, navigation and modifier keys, and the rejection of `F25` and `Numpad10`. I checked every expected value against the mapping in `capture.js` and against the `keyNames` list in `keys.js`, and the expectations match both. No test has run on this head: the `Build` and `Input mapper` workflow runs are waiting for maintainer approval (`action_required`). ## What I ran - Head `29a01b1942c51d536910aeaeb6e8796d3c2f697b`; base `b41526345185943c53af0c6eee97863df4389c9e`. 1 file, +35: `tools/input-mapper/tests/mapping.test.js` (two new tests). - Read the two new tests in full. Read `captureKey` in `tools/input-mapper/capture.js`, its rules for letters, digits, numpad digits, F1 to F24, and the mapping table. Read the `keyNames` list in `tools/input-mapper/keys.js`. - Checked the 101 expected value pairs of the first new test against `keyNames`: all 101 are present. The rules give the same values as the test for every code the test lists. The `F25` and `Numpad10` cases are rejected by the rules as the second test expects. - Hosted: the `Build` and `Input mapper` workflow runs for this head are `action_required` (they wait for approval). The `Conventions` and `PR labels` runs passed. No run of `npm --prefix tools/input-mapper test` exists for this head. - Read-only checks from the trusted main checkout: diff check, conventions and PR template, and the stack check all passed. The ABI audit is not applicable. No PR-head JavaScript was run here. - No MarcZX10 review at this head. ## Results | Check | Result | Note | | --- | --- | --- | | Diff check | passed | | | Conventions and PR template | passed | conventions check from the main checkout | | Mergeability and dependencies | passed | stack check passed; no declared dependencies | | Expected values in the first test are in `keyNames` | passed by reading | 101 of 101 pairs present | | Expected values follow the rules in `captureKey` | passed by reading | letters, digits, numpad, F1 to F24, the mapping table | | Out-of-range function and numpad keys are rejected | passed by reading | `F25` and `Numpad10` take no matching rule | | The tests pass | not run | no run of `npm test` for this head; `Input mapper` is waiting for approval | | ABI audit | not applicable | no export changed | | Negative controls | not run | no local run | | Hosted CI | not run | `Build` and `Input mapper` are `action_required`; `Conventions` and `PR labels` passed | <details><summary>Read-only check output</summary> Precheck was not run: no PR-head code is run here. Diff check: passed. Conventions: passed. ABI audit: not applicable. Stack check: passed. Hosted: `gh api repos/boykopovar/AnyPS5/actions/runs?head_sha=29a01b1942c51d536910aeaeb6e8796d3c2f697b` (the `Build` and `Input mapper` runs are `action_required`). </details> ## Negative control Not run here. A negative control needs a local run of the test, and the PR's JavaScript is not run here. ## Findings **Blocking** None. **Non-blocking** None. ## Sources - Test: https://github.com/boykopovar/AnyPS5/blob/29a01b1942c51d536910aeaeb6e8796d3c2f697b/tools/input-mapper/tests/mapping.test.js - Source mapping: https://github.com/boykopovar/AnyPS5/blob/29a01b1942c51d536910aeaeb6e8796d3c2f697b/tools/input-mapper/capture.js - Key list: https://github.com/boykopovar/AnyPS5/blob/29a01b1942c51d536910aeaeb6e8796d3c2f697b/tools/input-mapper/keys.js - Workflow: https://github.com/boykopovar/AnyPS5/blob/29a01b1942c51d536910aeaeb6e8796d3c2f697b/.github/workflows/input-mapper.yml ## Not verified - That `npm test` passes on this head (it has not run). ## To get this to a good state - A maintainer approves the `Input mapper` run so that the test runs on this head.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!14294
No description provided.