json-file-plus
Advanced tools
Comparing version
{ | ||
"name": "json-file-plus", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"author": "Jordan Harband", | ||
@@ -27,5 +27,6 @@ "description": "Read from and write to a JSON file, minimizing diffs and preserving formatting.", | ||
"devDependencies": { | ||
"tape": "~0.3.2" | ||
"tape": "~0.3.2", | ||
"foreach": "~2.0.0" | ||
} | ||
} | ||
var test = require('tape'); | ||
var path = require('path'); | ||
var jsonFile = require('../index'); | ||
var forEach = require('foreach'); | ||
@@ -43,7 +44,7 @@ var noNewlineFilename = 'test/no-trailing-newline.json'; | ||
sst.test('with key', function (s2t) { | ||
Object.keys(testContents).forEach(function (key) { | ||
s2t.deepEqual(file.get(key), testContents[key], 'data from get("' + key + '") matches'); | ||
forEach(testContents, function (keyContents, key) { | ||
s2t.deepEqual(file.get(key), keyConstants, 'data from get("' + key + '") matches'); | ||
s2t.test('async', function (s3t) { | ||
file.get(key, function (err, data) { | ||
s3t.deepEqual(data, testContents[key], 'data from async get("' + key + '") matches'); | ||
s3t.deepEqual(data, keyConstants, 'data from async get("' + key + '") matches'); | ||
s3t.end(); | ||
@@ -50,0 +51,0 @@ }); |
7853
0.61%178
0.56%2
100%