wasm-rquickjs-cli 0.5.3

Tool for wrapping JavaScript modules as WebAssembly components using the QuickJS engine
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import assert from 'assert';
import sinon from 'sinon';

export const run = () => {
  const add = (a, b) => a + b;
  const spy = sinon.spy(add);

  const result = spy(2, 3);

  assert.strictEqual(result, 5);
  assert.strictEqual(spy.calledOnce, true);
  assert.strictEqual(spy.calledWithExactly(2, 3), true);
  assert.strictEqual(spy.firstCall.returnValue, 5);

  return 'PASS: spy tracks function calls and return values';
};