Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geojsonhint

Package Overview
Dependencies
Maintainers
5
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojsonhint - npm Package Compare versions

Comparing version 0.2.2 to 0.3.0

bin/HELP.md

5

CHANGELOG.md

@@ -0,1 +1,6 @@

## 0.3.0
* Now uses `tap` for tests
* Modernized binary supports streams
## 0.2.0

@@ -2,0 +7,0 @@

14

package.json
{
"name": "geojsonhint",
"version": "0.2.2",
"version": "0.3.0",
"description": "validate and sanity-check geojson files",

@@ -10,5 +10,4 @@ "main": "index.js",

"devDependencies": {
"expect.js": "~0.2.0",
"mocha": "~1.12.0",
"glob": "~3.2.6"
"glob": "~3.2.6",
"fuzzer": "~0.1.0"
},

@@ -19,3 +18,3 @@ "bin": {

"scripts": {
"test": "mocha -R spec"
"test": "tap test/*.js"
},

@@ -38,4 +37,7 @@ "repository": {

"optimist": "~0.6.0",
"colors": "~0.6.0-1"
"colors": "~0.6.0-1",
"tap": "~0.4.8",
"minimist": "0.0.8",
"concat-stream": "~1.4.4"
}
}

@@ -1,4 +0,5 @@

var expect = require('expect.js'),
var test = require('tap').test,
fs = require('fs'),
glob = require('glob'),
fuzzer = require('fuzzer'),
geojsonhint = require('../');

@@ -14,51 +15,50 @@

describe('geojsonhint', function() {
describe('validates correct files', function(done) {
glob.sync('test/data/good/*.geojson').forEach(function(f) {
it('validates ' + f, function() {
var gj = file(f);
expect(geojsonhint.hint(gj)).to.eql([]);
});
test('geojsonhint', function(t) {
glob.sync('test/data/good/*.geojson').forEach(function(f) {
var gj = file(f);
t.deepEqual(geojsonhint.hint(gj), [], 'good input: ' + f);
});
t.deepEqual(geojsonhint.hint(undefined), [{
message: 'Expected string input',
line: 0
}]);
t.deepEqual(geojsonhint.hint('{}'), [{
message: 'The type property is required and was not found',
line: 1
}]);
test('validates incorrect files', function(t) {
glob.sync('test/data/bad/*.geojson').forEach(function(f) {
var gj = file(f);
t.deepEqual(geojsonhint.hint(gj), filejs(f.replace('geojson', 'result')));
});
t.end();
});
it('requires an input', function() {
expect(geojsonhint.hint(undefined)).to.eql([{
message: 'Expected string input',
test('invalid roots', function(t) {
t.deepEqual(geojsonhint.hint('null'), [{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
});
it('requires a root type', function() {
expect(geojsonhint.hint('{}')).to.eql([{
message: 'The type property is required and was not found',
line: 1
t.deepEqual(geojsonhint.hint('1'), [{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
t.deepEqual(geojsonhint.hint('"string"'), [{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
t.end();
});
describe('validates incorrect files', function() {
glob.sync('test/data/bad/*.geojson').forEach(function(f) {
it('invalidates ' + f, function() {
var gj = file(f);
expect(geojsonhint.hint(gj)).to.eql(filejs(f.replace('geojson', 'result')));
});
});
glob.sync('test/data/good/*.geojson').forEach(function(f) {
var mutator = fuzzer.mutate.object(filejs(f));
for (var i = 0; i < 100; i++) {
try {
var input = mutator();
geojsonhint.hint(input);
t.ok('done');
} catch(e) {
t.fail('exception on ' + JSON.stringify(input));
}
}
});
describe('invalid roots', function() {
it('null', function() {
expect(geojsonhint.hint('null')).to.eql([{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
});
it('number', function() {
expect(geojsonhint.hint('1')).to.eql([{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
});
it('string', function() {
expect(geojsonhint.hint('"string"')).to.eql([{
message: 'The root of a GeoJSON object must be an object.',
line: 0
}]);
});
});
t.end();
});

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc