Chai assertions to use with Leaflet map apps
JavaScript HTML
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
test
.eslintrc
.mversionrc
.travis.yml
LICENSE
README.md
chai-leaflet.js
package.json

README.md

chai-leaflet

Chai assertions to test Leaflet apps.

Usage

In the browser, just add <script src="chai-leaflet.js"></script> after including chai. Now you can write tests like this:

chai.should();

it('example', function () {
	latlng.should.be.near([51, 4]);

	map.should.have.view([33, 2], 4);

	map.should.have.zoom(18);
});

Because chai-leaflet depends on a global L it does not work out of the box on node.js. You may use leaflet-headless to work around that.

var L = require('leaflet-headless');
var chai = require('chai');
chai.use(require('chai-leaflet'));

chai = chai.should();

// your tests here