Home

Awesome

geojson-assert

thin wrapper around geojsonhint to allows you to easily use it to assertion test.

test object taken from chai, test data taken from geojsonhint.

install with npm

npm install geojson-assert

general usage

var assert = require('geojson-assert');
assert(geojson);

geojson-assert is somewhat less picky then geojsonhint and you can give it a str or an object.

If you pass true to the second argument it assumes you are passing a dict where values are valid geojson.

var assert = require('geojson-assert');
assert({
    thing1:geojson,
    thing2:moreGeoJson
}, true);

using it async in mocha

var assert = require('geojson-assert');
it('should work',function(done){
    fs.readFile('path to json',{encoding:'utf8'},function(err,result){
        if(err){
            return done(err);
        }
        done(assert(result));
    });
});