Add failing tests for #82 - #95
Conversation
|
There was a problem hiding this comment.
Pull Request Overview
Adds a targeted test suite for Issue #82 to verify instance sharing between implicitly and explicitly created molecules, particularly under Strict Mode behavior changes.
- Adds three tests exercising explicit-then-implicit and implicit-then-explicit ordering, including a real-component toggle scenario.
- Introduces render from @testing-library/react to support component-level testing.
- Uses test.fails to mark the known failing path in Strict Mode (implicit then explicit).
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
7cd71e6 to
565c2d7
Compare
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
565c2d7 to
2b73b9a
Compare
2b73b9a to
904b12f
Compare
| let initialValue: string; | ||
| let instancesAfterFirst: number; | ||
| let aValue: string; | ||
| let bValue: string; |
There was a problem hiding this comment.
The variables initialValue, aValue, and bValue are typed as string, but textContent returns string | null. With TypeScript strict mode enabled, this could cause a type error. Consider either:
- Changing the type to
string | null, or - Using a non-null assertion operator (
!) since in this test context the elements will always have text content, or - Using a default value with the nullish coalescing operator (
?? "")
Description of the change
Add tests for issue #82.
These tests "passes" for now and can be merged but will not pass when fixed (using vitest'sEdit: removed thetest.fails).test.failsusage.The tests shows that when when molecule is first implicit created then explicitely created in strict mode then it doesn't share the same instance in a complex scenario involving toggling on and off the explicit molecule.
The good news :
useMemochanged behavior (see chore: update react to 19 and fix strict mode tests #89)Type of change