Skip to content

Commit

Permalink
Fixes #3 with throws assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
jmakeig committed Sep 6, 2016
1 parent 6f58e41 commit 2fb24a2
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions test/throws.test.js
Expand Up @@ -5,14 +5,19 @@ const remote = require('../marklogic-remote')(/* connection */);
const parseTAP = require('../lib/tap-helpers').parseTAP;

test('assert.throws()', (assert) => {
assert.plan(1);
assert.plan(7);
remote('test/throws.test.sjs') // CHANGE ME
.then((tap) => {
//assert.comment(tap.length);
parseTAP(tap)
.then(tree => assert.true('object' === typeof tree, 'Non-null parse tree (baby steps)'))
.catch(error => assert.fail(error));
.then((tap) => parseTAP(tap))
.then(tap => {
assert.equal(tap.count, 3, 'Three total tests run');
assert.equal(tap.pass, 2, 'Two total tests pass');
assert.equal(tap.fail, 1, 'Two total tests fail');
const failure = tap.failures[0];
assert.skip(failure.diag.operator, 'throws', 'Operator is throws');
assert.equal(failure.diag.expected, 'ReferenceError');
assert.equal(failure.diag.actual, 'TypeError');
assert.equal(failure.diag.at, '/test/throws.test.sjs:17:19', 'Failure location')
})
.catch((error, stderr) => assert.fail(error.body.errorResponse.message));
.catch(error => assert.fail(error));
});

0 comments on commit 2fb24a2

Please sign in to comment.