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

Tests #27.
master
Maciej Małecki 2011-12-25 15:38:39 +01:00
parent 963387cfd4
commit e0e070ab28
1 changed files with 4 additions and 3 deletions

View File

@ -94,19 +94,20 @@ vows.describe('nconf/stores/file').addBatch({
tmpStore.set(key, data[key]);
});
tmpStore.saveSync();
var saved = tmpStore.saveSync();
fs.readFile(tmpStore.file, function (err, d) {
fs.unlinkSync(tmpStore.file);
return 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.deepEqual(read, data);
assert.deepEqual(read, saved);
}
}
}