test: fix missing edge case in test-blob-slice-with-large-size · nodejs/node@53cb298

Original file line numberDiff line numberDiff line change

@@ -1,4 +1,7 @@

11

'use strict';

2+
3+

// This tests that Blob.prototype.slice() works correctly when the size of the

4+

// Blob is outside the range of 32-bit signed integers.

25

const common = require('../common');

36
47

// Buffer with size > INT32_MAX

@@ -14,8 +17,11 @@ try {

1417

const slicedBlob = blob.slice(size - 1, size);

1518

assert.strictEqual(slicedBlob.size, 1);

1619

} catch (e) {

17-

if (e.code !== 'ERR_MEMORY_ALLOCATION_FAILED') {

18-

throw e;

20+

if (e.code === 'ERR_MEMORY_ALLOCATION_FAILED') {

21+

common.skip('insufficient space for Buffer.allocUnsafe');

22+

}

23+

if (/Array buffer allocation failed/.test(e.message)) {

24+

common.skip('insufficient space for Blob.prototype.slice()');

1925

}

20-

common.skip('insufficient space for Buffer.allocUnsafe');

26+

throw e;

2127

}