mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-10-11 03:38:07 +00:00
test(lbug): de-brittle the close/CHECKPOINT structural guard (#2264 review P2)
lbug-checkpoint.test.ts grepped the adapter SOURCE (comments included) for
conn.close()/db.close()/.query('CHECKPOINT') literals, coupling a passing test to
comment wording — a prior commit had to reword a comment just to keep it green.
Strip comments from the read source before the structural assertions so they
reflect code only; the invariant (exactly two CHECKPOINT sites; close calls only
in safeClose) is preserved and no longer breaks on a comment edit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JBJomjoTdBV2eveDVq4JMm
This commit is contained in:
parent
b96a55fb3c
commit
c2275c81e6
1 changed files with 13 additions and 3 deletions
|
|
@ -23,10 +23,20 @@ import { flushWAL } from '../../src/core/lbug/lbug-adapter.js';
|
|||
describe('flushWAL / safeClose — consolidation guard (#1376)', () => {
|
||||
let adapterSource: string;
|
||||
|
||||
// Strip comments before the structural assertions so they reflect CODE only.
|
||||
// Otherwise a `conn.close()` / `db.close()` / `.query('CHECKPOINT')` token
|
||||
// mentioned in a doc comment would falsely trip (or vacuously satisfy) a guard,
|
||||
// coupling the test to comment wording — exactly the brittleness flagged in the
|
||||
// #2264 review (a prior commit had to reword a comment just to keep this green).
|
||||
const codeOnly = (src: string): string =>
|
||||
src.replace(/\/\*[\s\S]*?\*\//g, '').replace(/\/\/[^\n]*/g, '');
|
||||
|
||||
beforeAll(async () => {
|
||||
adapterSource = await fs.readFile(
|
||||
path.join(__dirname, '..', '..', 'src', 'core', 'lbug', 'lbug-adapter.ts'),
|
||||
'utf-8',
|
||||
adapterSource = codeOnly(
|
||||
await fs.readFile(
|
||||
path.join(__dirname, '..', '..', 'src', 'core', 'lbug', 'lbug-adapter.ts'),
|
||||
'utf-8',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue