[node][tests] Add a test for making sure the map object throws on invalid style

Currently this error is not reported.
This commit is contained in:
Thiago Marcos P. Santos
2016-08-25 12:38:05 +03:00
parent a12fa9333b
commit 05ba97b2b7

View File

@@ -104,6 +104,21 @@ test('Map', function(t) {
t.end();
});
t.test('requires a map style to be a valid style JSON', function(t) {
var map = new mbgl.Map(options);
t.throws(function() {
map.load('foo bar');
}, /Requires a map style to be a valid style JSON/);
t.throws(function() {
map.load('""');
}, /Requires a map style to be a valid style JSON/);
map.release();
t.end();
});
t.test('expect either an object or array at root', { timeout: 1000 }, function(t) {
var map = new mbgl.Map(options);
@@ -116,7 +131,9 @@ test('Map', function(t) {
t.end();
});
map.load('invalid');
t.throws(function() {
map.load('invalid');
}, /Requires a map style to be a valid style JSON/);
});
t.test('accepts an empty stylesheet string', function(t) {