jmakeig / mltap

A JavaScript test harness for MarkLogic that (roughly) implements the Node.js tape API
Apache License 2.0
0 stars 0 forks source link

Run tests “inline” in Query Console #44

Closed jmakeig closed 8 years ago

jmakeig commented 8 years ago

Something like:

const mltap = require('/mltap/mltap');

const test = test('A test', (assert) => {
  …
});

mltap([test]).run().asTAP();
jmakeig commented 8 years ago
'use strict';
const mltap = require('/mltap/mltap');
const test = require('/mltap/test');
mltap(
  test('One', assert => {
    assert.plan(1);
    assert.equal(null, null, 'null gonna null');
  }),
  test('Two', assert => {
    assert.plan(2);
    assert.true(true, 'Nothing more true than true');
    assert.deepEqual({a: 'A', b: 'B'}, {b: 'B', a: 'A'}, 'Key order');
  }),
  test('Three', assert => {
    assert.equal(2 + 2, 5, 'Two and two is not five');
    assert.end();
  })
);