Skip to content

Commit

Permalink
[string] dump and load
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari authored and nolanlawson committed Sep 8, 2015
1 parent 4f872df commit 294b8aa
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,7 @@ function tests(dbName, dbType) {
});
});

it('should dump to a string', function () {

var MemoryStream = require('memorystream');

it('should dump and load using string', function () {
var dumpedString = '';
var readStream = new MemoryStream();
readStream.on('data', function (chunk) {
Expand All @@ -223,9 +220,17 @@ function tests(dbName, dbType) {
return db.dump(readStream);
}).then(function () {
dumpedString.should.be.a('string', 'got a string');

var writeStream = new MemoryStream();
writeStream.end(dumpedString);

return remote.load(writeStream);
}).then(function () {
return remote.allDocs();
}).then(function (docs) {
docs.rows.should.have.length(1);
docs.rows[0].id.should.equal('1');
});
});

});

}

0 comments on commit 294b8aa

Please sign in to comment.