geojsonhint
Advanced tools
Comparing version
@@ -0,1 +1,6 @@ | ||
## 0.3.0 | ||
* Now uses `tap` for tests | ||
* Modernized binary supports streams | ||
## 0.2.0 | ||
@@ -2,0 +7,0 @@ |
{ | ||
"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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Unidentified License
License(Experimental) Something that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
152450
1.22%2
-33.33%72
2.86%0
-100%0
-100%6
100%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
- Removed