Skip to content

Commit db328c9

Browse files
author
Hanbyul Jo
authored
Merge pull request #397 from mapzen/hanb/improve-test
added tests to each case of component initialization
2 parents efd6f02 + 27aa83c commit db328c9

File tree

3 files changed

+66
-6
lines changed

3 files changed

+66
-6
lines changed

test/karma.conf.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,8 @@ module.exports = function (config) {
1313
'node_modules/sinon/pkg/sinon.js',
1414
'node_modules/expect.js/index.js',
1515
'node_modules/happen/happen.js',
16-
'src/js/*.js',
17-
'src/js/**/*.js',
18-
'test/spec/mapControl.js',
19-
'test/spec/hash.js'
16+
'dist/mapzen.js',
17+
'test/spec/*.js'
2018
],
2119

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

@@ -116,6 +113,6 @@ module.exports = function (config) {
116113
}
117114
},
118115

119-
browsers: ['PhantomJS', 'bs_ie_window']
116+
browsers: ['PhantomJS', 'bs_ie_window', 'bs_iphone6S']
120117
});
121118
};

test/spec/routing.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
describe('Routing Test', function () {
2+
var el;
3+
var map;
4+
5+
before(function (done) {
6+
L.Mapzen.apiKey = 'mapzen-cstHyBQ';
7+
done();
8+
})
9+
10+
describe('Basic Routing Check', function () {
11+
12+
it('checks routing component is initialized.', function (done) {
13+
var routingControl = L.Mapzen.routing.control({
14+
router: L.Mapzen.routing.router({costing: 'bicycle'})
15+
});
16+
done();
17+
});
18+
19+
it('checks routing component with both apikey and option is initialized', function (done) {
20+
var routingControl = L.Mapzen.routing.control({
21+
router: L.Mapzen.routing.router('mapzen-cstHyBQ', {costing: 'bicycle'})
22+
});
23+
done();
24+
});
25+
26+
})
27+
});

test/spec/search.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
describe('Search Test', function () {
2+
var el;
3+
var map;
4+
5+
before(function (done) {
6+
L.Mapzen.apiKey = 'mapzen-cstHyBQ';
7+
done();
8+
})
9+
10+
describe('Basic Geocoder Check', function () {
11+
it('checks geocoder is initialized', function (done) {
12+
var geocoder = L.Mapzen.geocoder();
13+
done();
14+
});
15+
16+
it('checks geocoder with api key is initialized', function (done) {
17+
var geocoder = L.Mapzen.geocoder('mapzen-cstHyBQ');
18+
done();
19+
});
20+
21+
it('checks geocoder with option is initialized', function (done) {
22+
var geocoder = L.Mapzen.geocoder({
23+
autocomplete: false,
24+
attribution: 'test attribution'
25+
});
26+
done();
27+
});
28+
29+
it('checks geocoder with both api key and option is initialized', function (done) {
30+
var geocoder = L.Mapzen.geocoder('mapzen-cstHyBQ', {
31+
autocomplete: false
32+
});
33+
done();
34+
});
35+
})
36+
});

0 commit comments

Comments
 (0)