-
-
Notifications
You must be signed in to change notification settings - Fork 31
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Why do we need this improvement?
The Node.js WebSocket template currently generates a functional WebSocket server, but there are no automated tests validating the generated output. This means that any change to the template can unintentionally break the generated server without being detected early.
Since this repository provides a code generation template, users rely on the generated code to work correctly out of the box. Without automated tests, regressions may only be discovered after users manually generate and run the project, leading to a poor developer experience and increased maintenance effort.
How will this change help?
This improvement will:
- Ensure the generated WebSocket server starts correctly
- Verify that WebSocket clients can successfully connect
- Validate that messages defined in the AsyncAPI document are handled as expected
- Ensure invalid or malformed messages are handled gracefully without crashing the server
Overall, this will increase confidence in the template, reduce regressions, and improve reliability for both users and maintainers.
Screenshots
No response
How could it be implemented/designed?
A possible implementation approach:
- Create a minimal AsyncAPI document as a test fixture
- Generate a WebSocket server from the template using this document
- Start the generated server programmatically during tests
- Use a WebSocket client (e.g., ws) to simulate client connections
- Add tests for:
- Server startup
- Client connection success
- Handling of valid messages
- Graceful handling of invalid messages
- Integrate these tests into the existing test or CI workflow
This approach keeps the scope focused while providing meaningful coverage of the generated output.
🚧 Breaking changes
Yes
👀 Have you checked for similar open issues?
- I checked and didn't find a similar issue
🏢 Have you read the Contributing Guidelines?
- I have read the Contributing Guidelines
Are you willing to work on this issue?
None
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request