Merge pull request #3517 from marcjansen/basic-tests
Add tests for previously untested classes
This commit is contained in:
16
test/spec/ol/binary.test.js
Normal file
16
test/spec/ol/binary.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.buffer');
|
||||
|
||||
describe('ol.binary.Buffer', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.binary.Buffer();
|
||||
expect(instance).to.be.an(ol.binary.Buffer);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.binary.Buffer');
|
||||
16
test/spec/ol/control/fullscreencontrol.test.js
Normal file
16
test/spec/ol/control/fullscreencontrol.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.control.FullScreen');
|
||||
|
||||
describe('ol.control.FullScreen', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.control.FullScreen();
|
||||
expect(instance).to.be.an(ol.control.FullScreen);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.control.FullScreen');
|
||||
16
test/spec/ol/control/mousepositioncontrol.test.js
Normal file
16
test/spec/ol/control/mousepositioncontrol.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.control.MousePosition');
|
||||
|
||||
describe('ol.control.MousePosition', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.control.MousePosition();
|
||||
expect(instance).to.be.an(ol.control.MousePosition);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.control.MousePosition');
|
||||
16
test/spec/ol/control/scalelinecontrol.test.js
Normal file
16
test/spec/ol/control/scalelinecontrol.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.control.ScaleLine');
|
||||
|
||||
describe('ol.control.ScaleLine', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.control.ScaleLine();
|
||||
expect(instance).to.be.an(ol.control.ScaleLine);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.control.ScaleLine');
|
||||
16
test/spec/ol/control/zoomtoextentcontrol.test.js
Normal file
16
test/spec/ol/control/zoomtoextentcontrol.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.control.ZoomToExtent');
|
||||
|
||||
describe('ol.control.ZoomToExtent', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.control.ZoomToExtent();
|
||||
expect(instance).to.be.an(ol.control.ZoomToExtent);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.control.ZoomToExtent');
|
||||
16
test/spec/ol/deviceorientation.test.js
Normal file
16
test/spec/ol/deviceorientation.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.DeviceOrientation');
|
||||
|
||||
describe('ol.DeviceOrientation', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.DeviceOrientation();
|
||||
expect(instance).to.be.an(ol.DeviceOrientation);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.DeviceOrientation');
|
||||
16
test/spec/ol/format/binaryfeatureformat.test.js
Normal file
16
test/spec/ol/format/binaryfeatureformat.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.format.BinaryFeature');
|
||||
|
||||
describe('ol.format.BinaryFeature', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.format.BinaryFeature();
|
||||
expect(instance).to.be.an(ol.format.BinaryFeature);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.format.BinaryFeature');
|
||||
16
test/spec/ol/geolocation.test.js
Normal file
16
test/spec/ol/geolocation.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.Geolocation');
|
||||
|
||||
describe('ol.Geolocation', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.Geolocation();
|
||||
expect(instance).to.be.an(ol.Geolocation);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.Geolocation');
|
||||
101
test/spec/ol/imageurlfunction.test.js
Normal file
101
test/spec/ol/imageurlfunction.test.js
Normal file
@@ -0,0 +1,101 @@
|
||||
goog.provide('ol.test.ImageUrlFunction');
|
||||
|
||||
describe('ol.ImageUrlFunction', function() {
|
||||
|
||||
describe('#createFromParamsFunction', function() {
|
||||
|
||||
it('is a defined function', function() {
|
||||
expect(ol.ImageUrlFunction.createFromParamsFunction).to.not.be(undefined);
|
||||
expect(ol.ImageUrlFunction.createFromParamsFunction).to.be.a(Function);
|
||||
});
|
||||
|
||||
it('returns a function that throws when called (no arguments)', function() {
|
||||
var got = ol.ImageUrlFunction.createFromParamsFunction();
|
||||
expect(function() {
|
||||
got();
|
||||
}).to.throwException();
|
||||
});
|
||||
|
||||
it('returns a function that doesn\'t throw when called (valid arguments)',
|
||||
function() {
|
||||
var baseUrl = 'foo',
|
||||
params = {foo: 'bar'},
|
||||
paramsFunction = sinon.spy(),
|
||||
got = ol.ImageUrlFunction.createFromParamsFunction(baseUrl,
|
||||
params, paramsFunction);
|
||||
|
||||
expect(function() {
|
||||
got();
|
||||
}).to.not.throwException();
|
||||
}
|
||||
);
|
||||
|
||||
it('passes given baseUrl to given paramsFunction', function() {
|
||||
var baseUrl = 'foo',
|
||||
params = {foo: 'bar'},
|
||||
spy = sinon.spy(),
|
||||
got = ol.ImageUrlFunction.createFromParamsFunction(baseUrl, params,
|
||||
spy);
|
||||
|
||||
got();
|
||||
|
||||
expect(spy.called).to.be(true);
|
||||
expect(spy.calledOnce).to.be(true);
|
||||
expect(spy.calledWith(baseUrl)).to.be(true);
|
||||
});
|
||||
|
||||
it('passes given params to given paramsFunction', function() {
|
||||
var baseUrl = 'foo',
|
||||
params = {foo: 'bar'},
|
||||
spy = sinon.spy(),
|
||||
got = ol.ImageUrlFunction.createFromParamsFunction(baseUrl, params,
|
||||
spy);
|
||||
|
||||
got();
|
||||
|
||||
expect(spy.called).to.be(true);
|
||||
expect(spy.calledOnce).to.be(true);
|
||||
expect(spy.calledWith(baseUrl, params)).to.be(true);
|
||||
});
|
||||
|
||||
it('passes five params to given paramsFunction', function() {
|
||||
var baseUrl = 'foo',
|
||||
params = {foo: 'bar'},
|
||||
extent = [1, 2, 3, 4],
|
||||
size = [47, 11],
|
||||
projection = ol.proj.get('CRS:84'),
|
||||
spy = sinon.spy(),
|
||||
firstArgs,
|
||||
got = ol.ImageUrlFunction.createFromParamsFunction(baseUrl, params,
|
||||
spy);
|
||||
|
||||
got(extent, size, projection);
|
||||
firstArgs = spy.args[0];
|
||||
|
||||
expect(spy.called).to.be(true);
|
||||
expect(spy.calledOnce).to.be(true);
|
||||
|
||||
expect(firstArgs.length).to.be(5);
|
||||
expect(firstArgs).to.eql([baseUrl, params, extent, size, projection]);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#nullImageUrlFunction', function() {
|
||||
|
||||
it('is a defined function', function() {
|
||||
expect(ol.ImageUrlFunction.nullImageUrlFunction).to.not.be(undefined);
|
||||
expect(ol.ImageUrlFunction.nullImageUrlFunction).to.be.a(Function);
|
||||
});
|
||||
|
||||
it('always returns undefined', function() {
|
||||
var got = ol.ImageUrlFunction.nullImageUrlFunction();
|
||||
expect(got).to.be(undefined);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.proj');
|
||||
goog.require('ol.ImageUrlFunction');
|
||||
16
test/spec/ol/interaction/draganddropinteraction.test.js
Normal file
16
test/spec/ol/interaction/draganddropinteraction.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.interaction.DragAndDrop');
|
||||
|
||||
describe('ol.interaction.DragAndDrop', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.interaction.DragAndDrop();
|
||||
expect(instance).to.be.an(ol.interaction.DragAndDrop);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.interaction.DragAndDrop');
|
||||
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.interaction.DragRotateAndZoom');
|
||||
|
||||
describe('ol.interaction.DragRotateAndZoom', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.interaction.DragRotateAndZoom();
|
||||
expect(instance).to.be.an(ol.interaction.DragRotateAndZoom);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.interaction.DragRotateAndZoom');
|
||||
16
test/spec/ol/interaction/snapinteraction.test.js
Normal file
16
test/spec/ol/interaction/snapinteraction.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.interaction.Snap');
|
||||
|
||||
describe('ol.interaction.Snap', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.interaction.Snap();
|
||||
expect(instance).to.be.an(ol.interaction.Snap);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.interaction.Snap');
|
||||
16
test/spec/ol/layer/heatmaplayer.test.js
Normal file
16
test/spec/ol/layer/heatmaplayer.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.layer.Heatmap');
|
||||
|
||||
describe('ol.layer.Heatmap', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed without arguments', function() {
|
||||
var instance = new ol.layer.Heatmap();
|
||||
expect(instance).to.be.an(ol.layer.Heatmap);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.layer.Heatmap');
|
||||
16
test/spec/ol/overlay.test.js
Normal file
16
test/spec/ol/overlay.test.js
Normal file
@@ -0,0 +1,16 @@
|
||||
goog.provide('ol.test.Overlay');
|
||||
|
||||
describe('ol.Overlay', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed with minimal arguments', function() {
|
||||
var instance = new ol.Overlay({});
|
||||
expect(instance).to.be.an(ol.Overlay);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.Overlay');
|
||||
21
test/spec/ol/tilegrid/zoomifytilegrid.test.js
Normal file
21
test/spec/ol/tilegrid/zoomifytilegrid.test.js
Normal file
@@ -0,0 +1,21 @@
|
||||
goog.provide('ol.test.tilegrid.Zoomify');
|
||||
|
||||
describe('ol.tilegrid.Zoomify', function() {
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed with minimal arguments', function() {
|
||||
var instance = new ol.tilegrid.Zoomify({
|
||||
resolutions: [],
|
||||
extent: [],
|
||||
origin: [],
|
||||
tileSize: []
|
||||
});
|
||||
expect(instance).to.be.an(ol.tilegrid.Zoomify);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
goog.require('ol.tilegrid.Zoomify');
|
||||
Reference in New Issue
Block a user