From d2aea963a4ce824122e511bdd3025eaa2d5d5ba5 Mon Sep 17 00:00:00 2001 From: Gergo Magyar Date: Mon, 21 Sep 2026 11:44:55 +0000 Subject: [PATCH] Address PR review feedback (#3340) Reset the pool forced-refusal mock Database sequence in native.reset() so later tests can still script the first construction as the checkpoint victim. --- gitnexus/test/unit/lbug-pool-forced-refusal-heal.test.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/gitnexus/test/unit/lbug-pool-forced-refusal-heal.test.ts b/gitnexus/test/unit/lbug-pool-forced-refusal-heal.test.ts index 9b9c2b9dd..5df6af52d 100644 --- a/gitnexus/test/unit/lbug-pool-forced-refusal-heal.test.ts +++ b/gitnexus/test/unit/lbug-pool-forced-refusal-heal.test.ts @@ -29,11 +29,13 @@ const { native } = vi.hoisted(() => { /** Script the FIRST read-only Database (index 0) as the checkpoint victim. */ refuseFirst: true, reset(options: { refuseFirst?: boolean } = {}) { + native.seq = 0; native.calls.constructions = []; native.calls.checkpoints = 0; native.calls.refusalProbes = 0; native.refuseFirst = options.refuseFirst ?? true; }, + seq: 0, }; return { native }; }); @@ -44,7 +46,6 @@ const { native } = vi.hoisted(() => { // recovery open and the read-only retry must never refuse, or the recovery // would kill itself. vi.mock('@ladybugdb/core', () => { - let seq = 0; class Database { role: 'ro' | 'rw'; index: number; @@ -55,7 +56,7 @@ vi.mock('@ladybugdb/core', () => { readOnly = false, ) { this.role = readOnly ? 'ro' : 'rw'; - this.index = seq++; + this.index = native.seq++; native.calls.constructions.push(this.role); } async init(): Promise {