From: shuse2 Date: Sun, 21 Jun 2020 11:25:47 +0000 (+0200) Subject: :white_check_mark: Update assertion method to capture error X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=8a573214305fadd331c510c7afe99de6955b59e3;p=buffer.git :white_check_mark: Update assertion method to capture error --- 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