]> zoso.dev Git - buffer.git/commitdiff
:white_check_mark: Update assertion method to capture error
authorshuse2 <shus.toda@gmail.com>
Sun, 21 Jun 2020 11:25:47 +0000 (13:25 +0200)
committershuse2 <shus.toda@gmail.com>
Sun, 21 Jun 2020 11:25:47 +0000 (13:25 +0200)
test/node/test-buffer-bigint64.js

index b11632fdc80cabef4af7a137b800c50850a19887..c4d05da6be4eb01838d70f12eacae6d924047e62 100644 (file)
@@ -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