Repository navigation
[test] Add a unit-test baseline for the canvas and rules layers - #181
Merged
Merged
Conversation
## summary - Extract canvas selection, drag, connection, shortcut, and generation-submission decisions into pure helpers and cover them with unit tests. - Add derivation tests for model identity, voice, audio role, reference checks, video mode, blockers, and reference budgets. - Preserve workspace behavior. The new files run in the existing `npm test` CI step. ## validation - `node --test tests/canvasInteraction.test.ts tests/rulesDerivation.test.ts` - `npm test` (601 passed) - `npx tsc --noEmit` - `npm run check:i18n` Fixes: #172 Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
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.
Summary
Adds a repeatable unit-test baseline for the canvas interaction surface and for
src/backend/rules.tsderivation, so later refactors (#174, #175) can fail on regressions. Product behavior is unchanged.Canvas selection, drag authoring, connection drops, node placement, keyboard actions, and image/video/audio/text generation submission were inline in
CanvasWorkspace. Those decisions now live in pure helpers (workspaceInteraction.ts,generationSettings.ts) that the workspace calls. The helpers are what the new tests exercise.Coverage
.canvasarchive round trip.New files are picked up by the existing CI step
npm test(node --test tests/*.test.ts). No workflow change.Validation
Run:
node --test tests/canvasInteraction.test.ts tests/rulesDerivation.test.tsnpm test— 601 passednpx tsc --noEmitnpm run check:i18n— 2864 keys, 168 Chinese source lines (legacy model names moved withgetNodeGenerationSettings; total unchanged)Not run:
npm run build(Vite production bundle)python -m pytestIntentional gaps
elementFromPoint, marquee) stay inCanvasWorkspace; tests cover the decisions those guards call.CreationProjectionstays covered by the existingtests/creationParameters.test.ts.Fixes #172