diff --git a/test/unit/middleware/confidenceScore.js b/test/unit/middleware/confidenceScore.js index 69821293..bf454381 100644 --- a/test/unit/middleware/confidenceScore.js +++ b/test/unit/middleware/confidenceScore.js @@ -5,17 +5,12 @@ module.exports.tests = {}; module.exports.tests.confidenceScore = function(test, common) { test('empty res and req should not throw exception', function(t) { - try { + function testIt() { confidenceScore({}, {}, function() {}); - t.pass('no exception'); - } - catch (e) { - t.fail('an exception should not have been thrown'); - } - finally { - t.end(); } + t.doesNotThrow(testIt, 'an exception should not have been thrown'); + t.end(); }); test('res.results without parsed_text should not throw exception', function(t) { @@ -27,18 +22,12 @@ module.exports.tests.confidenceScore = function(test, common) { meta: [10] }; - try { + function testIt() { confidenceScore(req, res, function() {}); - t.pass('no exception'); - } - catch (e) { - t.fail('an exception should not have been thrown'); - console.log(e.stack); - } - finally { - t.end(); } + t.doesNotThrow(testIt, 'an exception should not have been thrown'); + t.end(); }); test('hit without address should not error', function(t) { @@ -61,17 +50,12 @@ module.exports.tests.confidenceScore = function(test, common) { } }; - try { + function testIt() { confidenceScore(req, res, function() {}); - t.pass('no exception'); - } - catch (e) { - t.fail('an exception should not have been thrown with no address'); - console.log(e.stack); - } - finally { - t.end(); } + + t.doesNotThrow(testIt, 'an exception should not have been thrown with no address'); + t.end(); }); diff --git a/test/unit/middleware/confidenceScoreReverse.js b/test/unit/middleware/confidenceScoreReverse.js index 450fd0db..81d92a7c 100644 --- a/test/unit/middleware/confidenceScoreReverse.js +++ b/test/unit/middleware/confidenceScoreReverse.js @@ -6,16 +6,12 @@ module.exports.tests.confidenceScoreReverse = function(test, common) { test('res without results should not throw exception', function(t) { var res = {}; - try { + function testIt() { confidenceScoreReverse(null, res, function() {}); } - catch (e) { - t.fail('an exception should not have been thrown'); - } - finally { - t.end(); - } + t.doesNotThrow(testIt, 'an exception should not have been thrown'); + t.end(); }); test('res.results without data should not throw exception', function(t) { @@ -23,16 +19,12 @@ module.exports.tests.confidenceScoreReverse = function(test, common) { results: {} }; - try { + function testIt() { confidenceScoreReverse(null, res, function() {}); } - catch (e) { - t.fail('an exception should not have been thrown'); - } - finally { - t.end(); - } + t.doesNotThrow(testIt, 'an exception should not have been thrown'); + t.end(); }); test('0m <= distance < 1m should be given score 1.0', function(t) {