Test pb-long without BI support and fix found issues #573
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.
Initially my goal was simply to improve code coverage, but in doing so I discovered a number of issues related to pb-long when the test environment did not have BigInt support.
Issues discovered and fixed with pb-long w/o BI support:
PbLong.from()
did not throw when the string value was too small"-9223372036854775809"
,"-18446744073709551616"
protobuf-ts/packages/runtime/spec/pb-long.spec.ts
Lines 133 to 134 in 2f0ed59
Expected function to throw an Error.
protobuf-ts/packages/runtime/spec/pb-long.spec.ts
Lines 37 to 40 in 2f0ed59
Expected '-1' to be '18446744073709551615'.
protobuf-ts/packages/runtime/spec/pb-long.spec.ts
Lines 109 to 112 in 2f0ed59
Expected '--9223372036854776000' to be '-9223372036854775808'.
This change fixes those issues, ensures all pb-long tests are performed with and without BI support so the testing runtime environment doesn't strictly limit what can be tested. It also improves the test coverage for pb-long.