diff --git a/tests/unit/plugin-version-coupling.test.ts b/tests/unit/plugin-version-coupling.test.ts index 00b236aa..ffcc2a88 100644 --- a/tests/unit/plugin-version-coupling.test.ts +++ b/tests/unit/plugin-version-coupling.test.ts @@ -63,7 +63,9 @@ describe('getBrainyVersion() — synchronously correct on first call', () => { expect(v).toBe(PACKAGE_VERSION) expect(v).not.toBe('3.14.0') expect(v).not.toBe('0.0.0') // the unknown-read sentinel must not surface in a real install - expect(v.startsWith('8.')).toBe(true) + // Deliberately major-agnostic: the equality with PACKAGE_VERSION above already + // proves the sync read; this shape pin only guards against sentinel garbage. + expect(v).toMatch(/^\d+\.\d+\.\d+/) }) }) @@ -95,13 +97,16 @@ describe('version coupling at init() — no silent fallback', () => { await brain.close() }) - it('does NOT throw for a realistic cor 3.x range (^8.0.0) on a COLD init', async () => { + it('does NOT throw for a realistic version-matched caret range on a COLD init', async () => { // The actual regression: loadPlugins() is the first init step and makes the - // first getBrainyVersion() call, so a stale sync default would reject a - // correctly-matched native provider declaring the real 8.x range. A fresh - // brain registering a `^8.0.0` plugin must init cleanly. + // first getBrainyVersion() call, so a stale sync default ('3.14.0') would + // reject a correctly-matched native provider declaring the real caret range — + // it fails ^ just as it failed ^8, so the regression intent is + // preserved while the range stays major-agnostic. A fresh brain registering a + // `^.0.0` plugin must init cleanly. + const major = PACKAGE_VERSION.split('.')[0] const brain = memBrain() - brain.use(fakePlugin('@fake/cor-3x', { brainyRange: '^8.0.0' })) + brain.use(fakePlugin('@fake/cor-3x', { brainyRange: `^${major}.0.0` })) await expect(brain.init()).resolves.toBeUndefined() await brain.close() })