[test] Test if File.saveSync() returns store content

Tests #27.
This commit is contained in:
Maciej Małecki 2011-12-25 15:38:39 +01:00
parent 963387cfd4
commit e0e070ab28

View file

@ -94,19 +94,20 @@ vows.describe('nconf/stores/file').addBatch({
tmpStore.set(key, data[key]); tmpStore.set(key, data[key]);
}); });
tmpStore.saveSync(); var saved = tmpStore.saveSync();
fs.readFile(tmpStore.file, function (err, d) { fs.readFile(tmpStore.file, function (err, d) {
fs.unlinkSync(tmpStore.file); fs.unlinkSync(tmpStore.file);
return err return err
? that.callback(err) ? that.callback(err)
: that.callback(err, JSON.parse(d.toString())); : that.callback(err, JSON.parse(d.toString()), saved);
}); });
}, },
"should save the data correctly": function (err, read) { "should save the data correctly": function (err, read, saved) {
assert.isNull(err); assert.isNull(err);
assert.deepEqual(read, data); assert.deepEqual(read, data);
assert.deepEqual(read, saved);
} }
} }
} }