Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[node][tests] Add a test for making sure the map object throws on inv…
Browse files Browse the repository at this point in the history
…alid style

Currently this error is not reported.
  • Loading branch information
tmpsantos committed Aug 25, 2016
1 parent a12fa93 commit 05ba97b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion platform/node/test/js/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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) {
Expand Down

0 comments on commit 05ba97b

Please sign in to comment.