Skip to content
Snippets Groups Projects
Commit db287239 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

[fix] "Revert two blocks" test randomly fails

parent f2c3955f
Branches
Tags
No related merge requests found
......@@ -13,6 +13,8 @@ const expectJSON = httpTest.expectJSON;
const expectHttpCode = httpTest.expectHttpCode;
const expectAnswer = httpTest.expectAnswer;
const now = 1490000000;
const MEMORY_MODE = true;
const commonConf = {
ipv4: '127.0.0.1',
......@@ -31,7 +33,8 @@ const s1 = duniter(
pub: 'HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd',
sec: '51w4fEShBk1jCMauWu4mLpmDVfHksKmWcygpxriqCEZizbtERA6de4STKRkQBpxmMUwsKXRjSzuQ8ECwmqN1u2DP'
},
rootoffset: 10,
udTime0: now + 1,
medianTimeBlocks: 1,
sigQty: 1, dt: 1, ud0: 120
}, commonConf));
......@@ -40,8 +43,6 @@ const toc = user('toc', { pub: 'DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo', s
describe("Revert two blocks", function() {
const now = Math.floor(Date.now() / 1000);
before(function() {
return co(function *() {
......@@ -53,10 +54,10 @@ describe("Revert two blocks", function() {
yield cat.join();
yield toc.join();
yield commit(s1)({ time: now });
yield commit(s1)({ time: now + 10 });
yield commit(s1)({ time: now + 10 });
yield commit(s1)({ time: now + 1 });
yield commit(s1)({ time: now + 1 });
yield cat.sendP(51, toc);
yield commit(s1)({ time: now + 10 });
yield commit(s1)({ time: now + 1 });
yield s1.revert();
});
});
......@@ -69,13 +70,17 @@ describe("Revert two blocks", function() {
});
});
it('/block/1 should exist', function() {
it('/block/2 should exist', function() {
return expectJSON(rp('http://127.0.0.1:7712/blockchain/block/2', { json: true }), {
number: 2,
dividend: 120
});
});
it('/block/3 should NOT exist', function() {
return expectHttpCode(404, rp('http://127.0.0.1:7712/blockchain/block/3', { json: true }));
});
it('/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd should have only UD', function() {
return expectAnswer(rp('http://127.0.0.1:7712/tx/sources/HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd'), (body) => {
let res = JSON.parse(body);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment