expect-maplab
A plugin of expect.js(https://github.com/Automattic/expect.js) for maplab with assertions for Coordinate/GeoJSON/Layer
Usage
npm install expect-maplab --save-dev
with Karma
Install karma-expect-maplab
npm install karma-expect-maplab --save-dev
In karma.conf.js, Attention: always declare expect-maplab behind expect
frameworks: 'mocha' 'expect' 'expect-maplab' plugins: 'karma-expect' 'karma-expect-maplab'
Methods
approx: asserts that the value is approximately equal or not
tobe;tobe;
closeTo: asserts that whether the coordinate is closeTo another (approx with a delta of 1E-6)
tobe;tobe;
eqlGeoJSON: asserts that whether a GeoJSON object is equal with another (true if the coordinates are closeTo another's)
//true tobe;
painted: asserts the given layer or map is painted in the center with a offset.
var v = 'v';//asserts layer is painted in the centertobe;//whether the layer is painted with an offset {x:5, y:3} from the center.//a negative x to the left and a positive to the right.//a negative y to the top and a positive to the bottom.tobe;//assert the point's color is [255, 255, 255]tobe;//also support maptobe;