Conversation
|
@capyai review this |
There was a problem hiding this comment.
Pull request overview
Centralizes the fullscreen navigator.keyboard.lock() key-code list into a single renderer module so both the UI (App.tsx) and the WebRTC client use the same set, and adds a unit test for that module.
Changes:
- Added
FULLSCREEN_KEYBOARD_LOCK_CODESin a newkeyboardLock.tsmodule. - Updated
App.tsxandgfn/webrtcClient.tsto reuse the shared keyboard lock list. - Expanded the test script to run all
gfn/*.test.tstests and addedkeyboardLock.test.ts.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| opennow-stable/src/renderer/src/gfn/webrtcClient.ts | Replaces inline keyboard lock code list with imported shared constant. |
| opennow-stable/src/renderer/src/gfn/keyboardLock.ts | Introduces the centralized fullscreen keyboard lock codes list. |
| opennow-stable/src/renderer/src/gfn/keyboardLock.test.ts | Adds unit coverage for the centralized keyboard lock list. |
| opennow-stable/src/renderer/src/App.tsx | Replaces inline keyboard lock code list with imported shared constant. |
| opennow-stable/package.json | Updates test script to run all gfn test files. |
| "dist:signed": "npm run build && electron-builder", | ||
| "typecheck": "tsc --noEmit -p tsconfig.node.json && tsc --noEmit -p tsconfig.json", | ||
| "test": "tsx --test src/renderer/src/gfn/inputProtocol.test.ts" | ||
| "test": "tsx --test src/renderer/src/gfn/*.test.ts" |
There was a problem hiding this comment.
The *.test.ts glob in the test script relies on shell glob expansion; this typically won’t expand on Windows (cmd.exe), which can cause tsx --test to receive the literal pattern and run zero tests. Consider using an explicit file list or a cross-platform glob mechanism (e.g., a small Node script that resolves test files) to ensure npm test works on all supported platforms.
| "test": "tsx --test src/renderer/src/gfn/*.test.ts" | |
| "test": "node --input-type=module -e \"import { readdirSync, statSync } from 'node:fs'; import path from 'node:path'; import { spawnSync } from 'node:child_process'; const root = 'src/renderer/src/gfn'; const walk = (dir) => readdirSync(dir).flatMap((entry) => { const fullPath = path.join(dir, entry); return statSync(fullPath).isDirectory() ? walk(fullPath) : fullPath.endsWith('.test.ts') ? [fullPath] : []; }); const files = walk(root); if (files.length === 0) { console.error('No test files found in ' + root); process.exit(1); } const result = spawnSync(process.execPath, ['./node_modules/tsx/dist/cli.mjs', '--test', ...files], { stdio: 'inherit' }); process.exit(result.status ?? 1);\"" |
| @@ -0,0 +1,12 @@ | |||
| export const FULLSCREEN_KEYBOARD_LOCK_CODES: readonly string[] = [ | |||
There was a problem hiding this comment.
as const is redundant here because the explicit : readonly string[] annotation widens the array type and discards the literal tuple typing. Consider removing the as const or switching to as const satisfies readonly string[] (or no explicit annotation) so the declaration is unambiguous.
Summary
Testing