1 | import Hashids from '../lib/hashids'
|
2 |
|
3 | const hashids = new Hashids()
|
4 | const _BigInt = typeof BigInt === 'function' ? BigInt : undefined
|
5 |
|
6 | describe('BigInt environment', () => {
|
7 | beforeAll(() => {
|
8 | // @ts-ignore
|
9 | delete global.BigInt
|
10 | })
|
11 |
|
12 | afterAll(() => {
|
13 | // @ts-ignore
|
14 | if (_BigInt) global.BigInt = _BigInt
|
15 | })
|
16 |
|
17 | test('throws decoding BigInt on unsupported environment', () => {
|
18 | expect(() =>
|
19 | hashids.decode('N95VW0Lo06rQBvJDOE2BVvREP86AqvYN4O9g9p'),
|
20 | ).toThrow()
|
21 | })
|
22 | })
|