From b0ca43f2ecff281949190111eda2eab7bf6f2537 Mon Sep 17 00:00:00 2001 From: Benoit Lavenier <benoit.lavenier@e-is.pro> Date: Tue, 6 Jun 2023 12:30:26 +0200 Subject: [PATCH] fix(1446): Unit test 'block-with-transaction-revert' : test the current block after each revert, and not only after the last revert --- .../block-with-transaction-revert.ts | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/integration/fork-resolution/block-with-transaction-revert.ts b/test/integration/fork-resolution/block-with-transaction-revert.ts index ddf726fc6..47f091844 100644 --- a/test/integration/fork-resolution/block-with-transaction-revert.ts +++ b/test/integration/fork-resolution/block-with-transaction-revert.ts @@ -17,6 +17,7 @@ import {DBBlock} from "../../../app/lib/db/DBBlock" import {CommonConstants} from "../../../app/lib/common-libs/constants" import {TestUser} from "../tools/TestUser" import {TestingServer} from "../tools/toolbox" +import {LevelDBSindex} from "../../../app/lib/dal/indexDAL/leveldb/LevelDBSindex"; describe('Block revert with transaction sources', () => writeBasicTestWithConfAnd2Users({ dt: 10, @@ -46,7 +47,7 @@ describe('Block revert with transaction sources', () => writeBasicTestWithConfAn const tx2 = await cat.prepareUTX(tx1, ['SIG(0)'], [ { qty: 100, base: 0, lock: 'SIG(' + tac.pub + ')' }, - { qty: 200, base: 0, lock: 'SIG(' + toc.pub + ')' }, // Send money also to toc, to test that his money is ketp safe during a revert + { qty: 200, base: 0, lock: 'SIG(' + toc.pub + ')' }, // Send money also to toc, to test that his money is kept safe during a revert { qty: 700, base: 0, lock: 'SIG(' + cat.pub + ')' }, // REST ], { @@ -74,10 +75,14 @@ describe('Block revert with transaction sources', () => writeBasicTestWithConfAn }) test('revert b#3-4 and re-commit block#3 should be ok', async (s1, cat, tac, toc) => { - await s1.revert() - await s1.revert() - await s1.resolve(b => b.number === 3) - await assertBlock3(s1, cat, tac, toc) + await s1.revert() // Revert b#4 + await assertBlock3(s1, cat, tac, toc) // Current is b#3 + + await s1.revert() // Revert b#3 + await assertBlock2(s1, cat, tac, toc) // Current is b#2 + + await s1.resolve(b => b.number === 3) // Waiting b#3 to commit + await assertBlock3(s1, cat, tac, toc) // Current is b#3 }) test('re-commit block#4 should be ok', async (s1, cat, tac, toc) => { -- GitLab