Skip to content

Commit

Permalink
added test for asNumber throwing exception
Browse files Browse the repository at this point in the history
Exception thrown was  Cannot convert a BigInt value to a number.

This test verifies that it can convert a big int

Signed-off-by: Camillo Positano <[email protected]>
  • Loading branch information
camillo-positano authored Jun 19, 2024
1 parent 133ba04 commit 21a3d93
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/asNumber.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict'

const test = require('tap').test

test('asNumber should convert BigInt', (t) => {
t.plan(1)
const Serializer = require('../lib/serializer')
const serializer = new Serializer()

const number = serializer.asNumber(11753021440n)

t.equal(number, '11753021440')
})

0 comments on commit 21a3d93

Please sign in to comment.