-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve BigInteger and BigSerial support
Change-type: major
- Loading branch information
Showing
6 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,39 @@ | ||
import * as helpers from './helpers'; | ||
|
||
helpers.describe('Big Integer', (test) => { | ||
const testBigIntString = String(Number.MAX_SAFE_INTEGER) + '00000001'; | ||
|
||
describe('fetchProcessing', function () { | ||
test.fetch(1, BigInt(1)); | ||
test.fetch('1', BigInt(1)); | ||
test.fetch('1', BigInt(1)); | ||
test.fetch(BigInt(testBigIntString), BigInt(testBigIntString)); | ||
test.fetch(testBigIntString, BigInt(testBigIntString)); | ||
test.fetch({}, new Error('Fetched bigint is not valid: object')); | ||
}); | ||
|
||
describe('validate', function () { | ||
test.validate(1, true, 1); | ||
test.validate('1', true, 1); | ||
test.validate( | ||
1.1, | ||
new RangeError( | ||
'The number 1.1 cannot be converted to a BigInt because it is not an integer', | ||
), | ||
); | ||
test.validate('1.1', new SyntaxError('Cannot convert 1.1 to a BigInt')); | ||
test.validate('', new Error('Cannot convert empty string to a BigInt')); | ||
test.validate( | ||
'testNotANumber', | ||
new Error('Cannot convert testNotANumber to a BigInt'), | ||
); | ||
test.validate( | ||
NaN, | ||
new SyntaxError( | ||
'The number NaN cannot be converted to a BigInt because it is not an integer', | ||
), | ||
); | ||
test.validate(1, true, BigInt(1)); | ||
test.validate('1', true, BigInt(1)); | ||
test.validate(BigInt(testBigIntString), true, BigInt(testBigIntString)); | ||
test.validate(testBigIntString, true, BigInt(testBigIntString)); | ||
}); | ||
}); |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ type TestFn = ( | |
| null | ||
| string | ||
| number | ||
| bigint | ||
| boolean | ||
| Date | ||
| Buffer | ||
|