Browse Source

Merge pull request #396 from pelias/master

Merge master into staging
pull/397/head
Diana Shkolnikov 9 years ago
parent
commit
b7dc0dc431
  1. 4
      circle.yml
  2. 24
      test/unit/helper/types.js
  3. 34
      test/unit/middleware/confidenceScore.js
  4. 20
      test/unit/middleware/confidenceScoreReverse.js

4
circle.yml

@ -9,9 +9,9 @@ deployment:
branch: master branch: master
commands: commands:
- git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install - git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install
- cd pelias-deploy && bundle exec rake deploy:api[dev] - cd pelias-deploy && bundle exec rake deploy:api dev
prod_build: prod_build:
branch: staging branch: staging
commands: commands:
- git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install - git clone git@github.com:mapzen/pelias-deploy.git && cd pelias-deploy && bundle install
- cd pelias-deploy && bundle exec rake deploy:api[prod_build] - cd pelias-deploy && bundle exec rake deploy:api prod_build

24
test/unit/helper/types.js

@ -4,29 +4,13 @@ module.exports.tests = {};
module.exports.tests.no_cleaned_types = function(test, common) { module.exports.tests.no_cleaned_types = function(test, common) {
test('no cleaned types', function(t) { test('no cleaned types', function(t) {
try { function testIt() {
types();
t.fail('exception should be thrown');
}
catch (err) {
t.equal(err.message, 'clean_types should not be null or undefined', 'no input should result in exception');
}
finally {
t.end();
}
});
test('no cleaned types', function(t) {
try {
types({}); types({});
t.fail('exception should be thrown');
}
catch (err) {
t.equal(err.message, 'clean_types should not be null or undefined', 'no input should result in exception');
} }
finally {
t.throws(testIt, /clean_types should not be null or undefined/, 'no input should result in exception');
t.end(); t.end();
}
}); });
}; };

34
test/unit/middleware/confidenceScore.js

@ -5,17 +5,12 @@ module.exports.tests = {};
module.exports.tests.confidenceScore = function(test, common) { module.exports.tests.confidenceScore = function(test, common) {
test('empty res and req should not throw exception', function(t) { test('empty res and req should not throw exception', function(t) {
try { function testIt() {
confidenceScore({}, {}, function() {}); 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) { 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] meta: [10]
}; };
try { function testIt() {
confidenceScore(req, res, function() {}); 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) { 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() {}); 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.doesNotThrow(testIt, 'an exception should not have been thrown with no address');
t.end(); t.end();
}
}); });

20
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) { test('res without results should not throw exception', function(t) {
var res = {}; var res = {};
try { function testIt() {
confidenceScoreReverse(null, res, function() {}); 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) { test('res.results without data should not throw exception', function(t) {
@ -23,16 +19,12 @@ module.exports.tests.confidenceScoreReverse = function(test, common) {
results: {} results: {}
}; };
try { function testIt() {
confidenceScoreReverse(null, res, function() {}); 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) { test('0m <= distance < 1m should be given score 1.0', function(t) {

Loading…
Cancel
Save