mirror of
https://github.com/nodejs/node.git
synced 2024-11-24 20:29:23 +01:00
938e11882b
Partition test/addons-napi into test/js-native-api and test/node-api to isolate the Node.js-agnostic portion of the N-API tests from the Node.js-specific portion. PR-URL: https://github.com/nodejs/node/pull/24557 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
25 lines
692 B
JavaScript
25 lines
692 B
JavaScript
'use strict';
|
|
const common = require('../../common');
|
|
const assert = require('assert');
|
|
|
|
// Testing api calls for arrays
|
|
const test_dataview = require(`./build/${common.buildType}/test_dataview`);
|
|
|
|
// Test for creating dataview
|
|
{
|
|
const buffer = new ArrayBuffer(128);
|
|
const template = Reflect.construct(DataView, [buffer]);
|
|
|
|
const theDataview = test_dataview.CreateDataViewFromJSDataView(template);
|
|
assert.ok(theDataview instanceof DataView,
|
|
`Expect ${theDataview} to be a DataView`);
|
|
}
|
|
|
|
// Test for creating dataview with invalid range
|
|
{
|
|
const buffer = new ArrayBuffer(128);
|
|
assert.throws(() => {
|
|
test_dataview.CreateDataView(buffer, 10, 200);
|
|
}, RangeError);
|
|
}
|