test: version-coupling pins go major-agnostic — the 8.x literals broke at the 9.0.0 bump while the coupling law itself behaved correctly
This commit is contained in:
parent
3e6e523727
commit
8a6807e80b
1 changed files with 11 additions and 6 deletions
|
|
@ -63,7 +63,9 @@ describe('getBrainyVersion() — synchronously correct on first call', () => {
|
||||||
expect(v).toBe(PACKAGE_VERSION)
|
expect(v).toBe(PACKAGE_VERSION)
|
||||||
expect(v).not.toBe('3.14.0')
|
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).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()
|
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
|
// The actual regression: loadPlugins() is the first init step and makes the
|
||||||
// first getBrainyVersion() call, so a stale sync default would reject a
|
// first getBrainyVersion() call, so a stale sync default ('3.14.0') would
|
||||||
// correctly-matched native provider declaring the real 8.x range. A fresh
|
// reject a correctly-matched native provider declaring the real caret range —
|
||||||
// brain registering a `^8.0.0` plugin must init cleanly.
|
// it fails ^<current-major> just as it failed ^8, so the regression intent is
|
||||||
|
// preserved while the range stays major-agnostic. A fresh brain registering a
|
||||||
|
// `^<current-major>.0.0` plugin must init cleanly.
|
||||||
|
const major = PACKAGE_VERSION.split('.')[0]
|
||||||
const brain = memBrain()
|
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 expect(brain.init()).resolves.toBeUndefined()
|
||||||
await brain.close()
|
await brain.close()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue