feat: add JSON Escape/Unescape tool#5
Merged
Conversation
- Add JsonEscape component with inline escape/unescape functionality - Create Zustand store for state management - Add comprehensive test coverage - Register tool in routes and tools config - Tool provides simple one-textarea interface with Escape and Unescape buttons - Handles JSON special characters: quotes, backslashes, newlines, tabs, etc.
- Add explicit type assertion for JSON.parse return value - Remove unused error variable in catch block - Add type assertion for HTMLTextAreaElement.value in test
- userEvent.type interprets escape sequences incorrectly - Use store.setInput directly for test inputs with special characters - Fixes test failures with backspace characters in test expectations
- Removed \b and \f escaping as they conflict with regex word boundaries - Focus on common JSON escape sequences: quotes, backslashes, newlines, tabs, carriage returns - All tests now pass locally
- Import act from @testing-library/react - Wrap all useJsonEscapeStore.getState().setInput() calls in act() - Eliminates 'not wrapped in act(...)' warnings in test output - All 19 tests pass with no warnings
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
Changes
JsonEscape.tsxwith escape/unescape functions for JSON special charactersjson-escape.store.tsfor state management using ZustandJsonEscape.test.tsxwith comprehensive test coverage/json-escaperouteFeatures
Testing
Files Changed