From 8a573214305fadd331c510c7afe99de6955b59e3 Mon Sep 17 00:00:00 2001 From: shuse2 Date: Sun, 21 Jun 2020 13:25:47 +0200 Subject: [PATCH] :white_check_mark: Update assertion method to capture error --- test/node/test-buffer-bigint64.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/node/test-buffer-bigint64.js b/test/node/test-buffer-bigint64.js index b11632f..c4d05da 100644 --- a/test/node/test-buffer-bigint64.js +++ b/test/node/test-buffer-bigint64.js @@ -37,10 +37,12 @@ const buf = Buffer.allocUnsafe(8) assert.throws(function() { const val = 0x10000000000000000n buf['writeBigUInt64' + endianness](val, 0) - }, { - code: 'ERR_OUT_OF_RANGE', - message: 'The value of "value" is out of range. It must be ' + - '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n' + }, function(err) { + assert(err instanceof RangeError) + assert(err.code === 'ERR_OUT_OF_RANGE') + assert(err.message === 'The value of "value" is out of range. It must be ' + + '>= 0n and < 2n ** 64n. Received 18_446_744_073_709_551_616n') + return true; }) // Should throw a TypeError upon invalid input -- 2.34.1