refactor(test): consolidate createFakeBackend factories into shared helper#92
Merged
Merged
Conversation
…elper Introduces test/helpers/fakeBackend.ts exporting a single createFakeBackend() with the union of capabilities needed across all four test files (bootImplementation, resultOverrides, writePng, fail, onScreenshot). Migrates all four call sites to the shared helper, removing ~300 lines of duplicated stub code. Closes #81 Change-Id: Ie0f6ec7dded45bf11bae732612cb4b581b64a9e9 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.com>
Re-add RendererBackend import in host/renderer.test.ts (used by the local BackendFactory type alias) and ScreenshotResult import in capture.test.ts (used by the it.each type casts). Also apply oxfmt formatting fixes to the three files flagged by CI. Change-Id: Iaf9d99786edf4858827c6e930e67563227fe5fa3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Thomas Kosiewski <tk@coder.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
test/helpers/fakeBackend.tsexporting a singlecreateFakeBackend()with the union of capabilities needed across all four test files (bootImplementation,resultOverrides,writePng,fail,onScreenshot)FakeRendererBackendtype (extendsRendererBackendwith*Mockaccessors andsetBooted) so all call sites can inspect mocks without re-declaring the typeCloses #81
Test plan
test/unit/renderer/registry.test.ts,test/unit/host/renderer.test.ts,test/unit/renderer/libghosttyVtBackend.test.ts,test/unit/screenshot/capture.test.ts🤖 Generated with Claude Code