From 294b8aa8a6c0f2d1262af280427ca68fe78bda77 Mon Sep 17 00:00:00 2001 From: Olivier Tassinari Date: Mon, 31 Aug 2015 14:03:05 +0100 Subject: [PATCH] [string] dump and load --- test/test.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/test.js b/test/test.js index 968720f..c9394cd 100644 --- a/test/test.js +++ b/test/test.js @@ -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) { @@ -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'); }); }); - }); - }