Feat/mock component#94
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.
Description
This pull request introduces comprehensive support for component mocking in the TWD testing framework, enabling developers to replace React components with mock implementations during tests. The update includes new APIs, documentation, example usage, and test coverage for component mocking, as well as minor dependency updates and improvements to the example app.
Component Mocking Feature:
mockComponentandclearComponentMocksAPIs totwd, allowing users to mock and reset React components by name for isolated testing. (src/twd.ts,src/index.ts, [1] [2] [3] [4]MockedComponentwrapper for marking components as mockable. (src/index.ts, src/index.tsR4)Documentation Enhancements:
component-mocking.mdguide with setup instructions, usage patterns, advanced examples, best practices, and troubleshooting tips. (docs/component-mocking.md, docs/component-mocking.mdR1-R355)mockComponentandclearComponentMocksusage with code samples. (docs/api/twd-commands.md, docs/api/twd-commands.mdR853-R974)docs/.vitepress/config.mts, docs/.vitepress/config.mtsR57)Example App Updates:
/mock-component) and page demonstrating component mocking in the example app. (examples/twd-test-app/src/pages/MockComponent.tsx, [1];examples/twd-test-app/src/routes.tsx, [2] [3]examples/twd-test-app/src/twd-tests/mock-component.twd.test.tsx, examples/twd-test-app/src/twd-tests/mock-component.twd.test.tsxR1-R54).tsxtest files. (examples/twd-test-app/src/main.tsx, examples/twd-test-app/src/main.tsxL10-R10)Internal & Test Coverage:
MockedComponentand component mocking logic. (src/tests/ui/mockComponent.spec.tsx, src/tests/ui/mockComponent.spec.tsxR1-R59)Dependency Updates:
package.json, package.jsonL69-R79)Fixes #92
Type of Change
Please delete options that are not relevant:
Testing
Test Details
Unit tests and E2E tests.
Documentation