From 526291f656b28216001647e5b3bc5817bc69dbb4 Mon Sep 17 00:00:00 2001 From: cgeek <cem.moreau@gmail.com> Date: Mon, 4 Jul 2016 19:02:17 +0200 Subject: [PATCH] Tests: sync command --- test/integration/cli.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/test/integration/cli.js b/test/integration/cli.js index 024c41162..13e707851 100644 --- a/test/integration/cli.js +++ b/test/integration/cli.js @@ -8,14 +8,18 @@ const cli = require('../../app/cli'); describe("CLI", function() { - describe("Initializing", () => { + it('reset data', () => co(function*() { + yield execute(['reset', 'data']); + const res = yield execute(['export-bc']); + JSON.parse(res).should.have.length(0); + })); - it('reset data', () => co(function*() { - yield execute(['reset', 'data']); - const res = yield execute(['export-bc']); - JSON.parse(res).should.have.length(0); - })); - }); + it('sync 10 blocks', () => co(function*() { + yield execute(['reset', 'data']); + yield execute(['sync', 'duniter.org', '8999', '9', '--nointeractive']); + const res = yield execute(['export-bc']); + JSON.parse(res).should.have.length(10); + })); }); /** @@ -31,7 +35,9 @@ function execute(command) { duniter.stdout.on('data', (data) => { res += data.toString('utf8').replace(/\n/, ''); }); - duniter.stderr.on('data', (err) => reject(err.toString('utf8'))); + duniter.stderr.on('data', (err) => { + console.log(err.toString('utf8').replace(/\n/, '')); + }); duniter.on('close', (code) => code ? reject(code) : resolve(res) ); }); }); -- GitLab