Repository navigation
Make six brittle tests derive their expectations from the source - #33
Merged
Merged
Conversation
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.
What this changes
Six brittle tests now derive their expectations from the command registry,
BUNDLE_SKILLS,model-floor.jsonand the real exported functions instead of literal lists, counted matches inmain.tsor prose. A newtest/helpers/source-blocks.tslocates a function body or IPC handler by bracket matching, so wiring tests check where a call sits.Key files
test/editor-demand-wiring.test.ts— contract: the editor server is requested only from the need-editor and restart handlers,launchEditoronly through the demand gate,keepWarmonly in the scan. Fails if arequest()is dropped from a handler or appears anywhere else, iflaunchEditoris called directly, or ifkeepWarmleavesrunScan.test/lantern-permissions-triggers.test.ts— contract: saving the skill linker or importing a list syncs the project's delegate rules afterwards, and a cancelled picker does not. Now calls the realregisterExtensionsIpcwith fakes; fails if either handler drops or reorders the sync, ormain.tsstops passingsyncPermissionsFor.test/lantern-macro-load.test.ts— contract:lantern:macrois behindfromWorkspace, checksisRegisteredDir, and carries the language from renderer to reader. Literal 14 blocks / 58 edges removed (the view is compared to the fixture view). Fails if the wrapper, the registered check or thelangargument goes.test/project-window.test.ts— contract: every registry command except on-demand ones is registered after boot. The 20-name list is nowCOMMANDS; fails if aregisterCommandis removed.test/install-skills.test.ts— contract: every bundled skill is installed. The 16-name list isBUNDLE_SKILLS, which must equal theskills/*/SKILL.mdfolders; fails if a skill is dropped from the bundle.test/lantern-sync-selftest.test.ts— contract: the mapping model policy accepts the floor's families and exact ids, advises below the recommended version, rejects the rest. Driven bymodel-floor.jsonand the CLI; fails if the advisory or the allow check inlib.mjsbreaks.Before / after
Before:
expect([...MAIN.matchAll(/editorDemand\.request\(\)/g)]).toHaveLength(2)and a hand-written command list. After: everyeditorDemand.request(lies inside the two handlers, andCOMMANDSsupplies the list.Verified with
pnpm install --frozen-lockfile,pnpm run typecheck,pnpm run lint,pnpm test, all green; each contract was also broken in source and the new test failed. Unreviewed fixes: none. Lantern: 7 files re-mapped.Run cost