diff options
author | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-08-25 12:38:05 +0300 |
---|---|---|
committer | Thiago Marcos P. Santos <thiago@mapbox.com> | 2016-08-25 22:05:00 +0300 |
commit | 05ba97b2b7c0b15d31b42fdd14094eab015c9c90 (patch) | |
tree | 3a347ffd8d74456c4659d2f7595db781448c0974 | |
parent | a12fa9333b9d58ffa38bf09d76bc2cca60a867e1 (diff) | |
download | qtlocation-mapboxgl-05ba97b2b7c0b15d31b42fdd14094eab015c9c90.tar.gz |
[node][tests] Add a test for making sure the map object throws on invalid style
Currently this error is not reported.
-rw-r--r-- | platform/node/test/js/map.test.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index e8434bc774..6ffbf3eb66 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -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) { |