Add Jest testing framework with comprehensive regex-focused unit tests for callsign.js #15
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.
This PR implements Jest as the testing framework for the callsign.js project and adds comprehensive unit tests with a primary focus on validating the core regex patterns that drive the library's functionality.
Changes Made
Testing Infrastructure
npm testandnpm run lintscripts to package.jsontests/directory with organized test filesUnit Test Coverage (71 tests total)
Primary Focus: Regex Pattern Validation
SEARCH_REGEX Pattern Tests (
tests/searchCallsigns.test.js)/([A-Z,\d]{1,3}\d[A-Z]{1,3}(?:\/\d)?)\s/patternW1ABC/3)PARTS_REGEX Pattern Tests (
tests/partsRegex.test.js)/([A-Z,\d]{1,3})(\d)([A-Z]{1,3})(?:\/(\d))?/patternSupporting Method Tests
getFlag Method Tests (
tests/getFlag.test.js)getPhonetics Method Tests (
tests/getPhonetics.test.js)W1AW→"Whiskey One Alfa Whiskey"Documentation Updates
npm testUsage
Verification
All existing functionality remains intact as demonstrated in the test page:
The screenshot shows:
✅ 71/71 tests pass
✅ ESLint validation passes
✅ Zero breaking changes
✅ Comprehensive regex pattern validation
✅ Complete requirements fulfillment
This implementation maintains the amateur radio community's philosophy of readable, educational code while adding robust regex-focused testing capabilities that validate the core patterns driving call sign detection and parsing functionality.
This pull request was created as a result of the following prompt from Copilot chat.
This pull request was created as a result of the following prompt from Copilot chat.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.