Skip to content

Commit

Permalink
Add internal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Jul 18, 2015
1 parent c0515b9 commit a28063d
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 6 deletions.
1 change: 0 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
},
"rules": {
"quotes": [2, "single"],
"key-spacing": [0],
"camelcase": [0],
"no-ternary": [2],
"valid-jsdoc": [2]
Expand Down
1 change: 0 additions & 1 deletion lib/services/geocoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ var invariant = require('invariant'),
function MapboxGeocoder(accessToken) {
invariant(typeof accessToken === 'string',
'accessToken required to instantiate MapboxGeocoder');
console.log('geocoder constructed');
this.accessToken = accessToken;
}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "interface to mapbox services",
"main": "lib/client.js",
"scripts": {
"lint": "eslint --no-eslintrc -c .eslintrc lib test/*.js",
"test": "tap --coverage test/*.js",
"docs": "documentation . --format=md > API.md",
"build": "browserify -s MapboxClient lib/client.js > dist/mapbox-sdk.js"
Expand Down
2 changes: 1 addition & 1 deletion test/directions.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var test = require('tap').test,
// fs = require('fs'),
// path = require('path'),
geojsonhint = require('geojsonhint'),
MapboxClient = require('../');
MapboxClient = require('../lib/services/directions');

test('MapboxClient#getDirections', function(t) {
t.test('typecheck', function(t) {
Expand Down
14 changes: 14 additions & 0 deletions test/format_points.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint no-shadow: 0 */
'use strict';

var test = require('tap').test,
formatPoints = require('../lib/format_points');

test('formatPoints', function(t) {
t.throws(function() {
formatPoints([['foo', 'bar']]);
});
t.equal(formatPoints([{latitude: 0, longitude: 0}]), '0,0');
t.equal(formatPoints([{latitude: 0, longitude: 0}, {latitude: 0, longitude: 10}]), '0,0;10,0');
t.end();
});
2 changes: 1 addition & 1 deletion test/geocode.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var test = require('tap').test,
// fs = require('fs'),
// path = require('path'),
geojsonhint = require('geojsonhint'),
MapboxClient = require('../');
MapboxClient = require('../lib/services/geocoder');

test('MapboxClient#geocodeForward', function(t) {
t.test('typecheck', function(t) {
Expand Down
11 changes: 11 additions & 0 deletions test/make_query.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/* eslint no-shadow: 0 */
'use strict';

var test = require('tap').test,
makeQuery = require('../lib/make_query');

test('makeQuery', function(t) {
t.equal(makeQuery('test', {}), '?access_token=test');
t.equal(makeQuery('test', {foo: 1}), '?foo=1&access_token=test');
t.end();
});
2 changes: 1 addition & 1 deletion test/matching.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var test = require('tap').test,
// fs = require('fs'),
// path = require('path'),
geojsonhint = require('geojsonhint'),
MapboxClient = require('../');
MapboxClient = require('../lib/services/matching');

test('MapboxClient#matching', function(t) {
t.test('typecheck', function(t) {
Expand Down
2 changes: 1 addition & 1 deletion test/surface.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ var test = require('tap').test,
// path = require('path'),
polyline = require('polyline'),
geojsonhint = require('geojsonhint'),
MapboxClient = require('../');
MapboxClient = require('../lib/services/surface');

test('MapboxClient#surface', function(t) {
t.test('typecheck', function(t) {
Expand Down

0 comments on commit a28063d

Please sign in to comment.