Skip to content

Commit

Permalink
Merge pull request #397 from mapzen/hanb/improve-test
Browse files Browse the repository at this point in the history
added tests to each case of component initialization
  • Loading branch information
Hanbyul Jo authored Jun 19, 2017
2 parents efd6f02 + 27aa83c commit db328c9
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 6 deletions.
9 changes: 3 additions & 6 deletions test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ module.exports = function (config) {
'node_modules/sinon/pkg/sinon.js',
'node_modules/expect.js/index.js',
'node_modules/happen/happen.js',
'src/js/*.js',
'src/js/**/*.js',
'test/spec/mapControl.js',
'test/spec/hash.js'
'dist/mapzen.js',
'test/spec/*.js'
],

plugins: [
Expand All @@ -42,7 +40,6 @@ module.exports = function (config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'src/**/*.js': ['browserify'],
'test/spec/*.js': ['browserify']
},

Expand Down Expand Up @@ -116,6 +113,6 @@ module.exports = function (config) {
}
},

browsers: ['PhantomJS', 'bs_ie_window']
browsers: ['PhantomJS', 'bs_ie_window', 'bs_iphone6S']
});
};
27 changes: 27 additions & 0 deletions test/spec/routing.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
describe('Routing Test', function () {
var el;
var map;

before(function (done) {
L.Mapzen.apiKey = 'mapzen-cstHyBQ';
done();
})

describe('Basic Routing Check', function () {

it('checks routing component is initialized.', function (done) {
var routingControl = L.Mapzen.routing.control({
router: L.Mapzen.routing.router({costing: 'bicycle'})
});
done();
});

it('checks routing component with both apikey and option is initialized', function (done) {
var routingControl = L.Mapzen.routing.control({
router: L.Mapzen.routing.router('mapzen-cstHyBQ', {costing: 'bicycle'})
});
done();
});

})
});
36 changes: 36 additions & 0 deletions test/spec/search.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
describe('Search Test', function () {
var el;
var map;

before(function (done) {
L.Mapzen.apiKey = 'mapzen-cstHyBQ';
done();
})

describe('Basic Geocoder Check', function () {
it('checks geocoder is initialized', function (done) {
var geocoder = L.Mapzen.geocoder();
done();
});

it('checks geocoder with api key is initialized', function (done) {
var geocoder = L.Mapzen.geocoder('mapzen-cstHyBQ');
done();
});

it('checks geocoder with option is initialized', function (done) {
var geocoder = L.Mapzen.geocoder({
autocomplete: false,
attribution: 'test attribution'
});
done();
});

it('checks geocoder with both api key and option is initialized', function (done) {
var geocoder = L.Mapzen.geocoder('mapzen-cstHyBQ', {
autocomplete: false
});
done();
});
})
});

0 comments on commit db328c9

Please sign in to comment.