0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-wasm-simple.js
Kyle Yu 96093981de test: add common.crashOnUnhandledRejection()
add common.crashOnUnhandledRejection() in test-wasm-simple.js

PR-URL: https://github.com/nodejs/node/pull/17236
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-11-22 08:01:14 -08:00

20 lines
489 B
JavaScript

'use strict';
const common = require('../common');
const assert = require('assert');
const fixtures = require('../common/fixtures');
common.crashOnUnhandledRejection();
const buffer = fixtures.readSync('test.wasm');
assert.ok(WebAssembly.validate(buffer), 'Buffer should be valid WebAssembly');
WebAssembly.instantiate(buffer, {}).then((results) => {
assert.strictEqual(
results.instance.exports.addTwo(10, 20),
30,
'Exported function should add two numbers.',
);
});