From 5e58070decb7ee5e1538a120e6b8261a0574d334 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Wed, 4 Nov 2015 18:18:08 -0500 Subject: [node] make ratio optional, default to 1.0 --- platform/node/test/js/map.test.js | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'platform/node/test/js/map.test.js') diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index a87f4aac1a..0ccaa4b55e 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -27,7 +27,7 @@ test('Map', function(t) { t.end(); }); - t.test('requires request and ratio options', function(t) { + t.test('requires request property', function(t) { var options = {}; t.throws(function() { @@ -40,20 +40,41 @@ test('Map', function(t) { }, /Options object must have a 'request' method/); options.request = function() {}; + t.doesNotThrow(function() { + new mbgl.Map(options); + }); + + t.end(); + }); + + t.test('optional cancel property must be a function', function(t) { + var options = { + request: function() {} + }; + options.cancel = 'test'; t.throws(function() { new mbgl.Map(options); }, /Options object 'cancel' property must be a function/); options.cancel = function() {}; - t.throws(function() { + t.doesNotThrow(function() { new mbgl.Map(options); - }, /Options object must have a numerical 'ratio' property/); + }); + + t.end(); + }); + + + t.test('optional ratio property must be a number', function(t) { + var options = { + request: function() {} + }; options.ratio = 'test'; t.throws(function() { new mbgl.Map(options); - }, /Options object must have a numerical 'ratio' property/); + }, /Options object 'ratio' property must be a number/); options.ratio = 1.0; t.doesNotThrow(function() { -- cgit v1.2.1