Conversation
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
bin templates in TemplateJson
streamich
left a comment
There was a problem hiding this comment.
- Also introduce
int64template, which is similar tointtemplate, but generates JavaScriptbigintnumbers. - When done make sure to run
yarn format:fixand fixyarn lintissues.
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Implemented the
The implementation follows the same pattern as the existing |
streamich
left a comment
There was a problem hiding this comment.
Test fails with:
FAIL src/structured/__tests__/TemplateJson.spec.ts
● Test suite failed to run
TypeError: Do not know how to serialize a BigInt
at stringify (<anonymous>)
at messageParent (node_modules/jest-worker/build/workers/messageParent.js:29:19)
Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Fixed the BigInt serialization issue in Jest tests. The problem was that Jest worker processes can't serialize BigInt values when communicating test results between processes. Changed the test assertions to convert BigInt values to strings using |
|
🎉 This PR is included in version 1.2.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This PR adds support for generating binary data and 64-bit integers using new template types in
TemplateJson.New Template Types
BinTemplate
The
BinTemplategeneratesUint8Arraydata with configurable length and octet value ranges:Int64Template
The
Int64Templategenerates JavaScriptbigintnumbers with configurable ranges:Usage Examples
Implementation Details
int64utility function for bigint random generationTemplateNodeunion type andTemplateShorthandto include both 'bin' and 'int64'generateBinandgenerateInt64methods withmaxNodeslimit supportBigInt()constructor instead of literalsTesting
Added comprehensive test coverage for both template types including:
maxNodeslimitsAll existing tests continue to pass, ensuring backward compatibility.
Fixes #6.
💡 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.