mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +00:00
Consolidates the reviewed version and visibility work from #24283 with the probe gating and structured error classification from #24296. Reject unsuccessful version probes, preserve diagnostic precedence, and assert that real quota reads start no model turn. Co-authored-by: Pablo Werlang <19828711+werlang@users.noreply.github.com>
52 lines
1.6 KiB
TypeScript
52 lines
1.6 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
compareAppVersions,
|
|
isPerfPrereleaseAppVersion,
|
|
isPrereleaseAppVersion,
|
|
isValidAppVersion,
|
|
parseCliVersion
|
|
} from './app-version'
|
|
|
|
describe('app version comparison', () => {
|
|
it('compares stable and prerelease versions with semver precedence', () => {
|
|
expect(compareAppVersions('1.4.9', '1.5.0')).toBeLessThan(0)
|
|
expect(compareAppVersions('1.5.0-rc.2', '1.5.0-rc.10')).toBeLessThan(0)
|
|
expect(compareAppVersions('1.5.0-rc.10', '1.5.0')).toBeLessThan(0)
|
|
expect(compareAppVersions('v1.5.0+build.2', '1.5.0+build.9')).toBe(0)
|
|
})
|
|
|
|
it('rejects incomplete versions and identifies prereleases', () => {
|
|
expect(isValidAppVersion('1.5')).toBe(false)
|
|
expect(isValidAppVersion('1.5.0')).toBe(true)
|
|
expect(isPrereleaseAppVersion('1.5.0-rc.1')).toBe(true)
|
|
expect(isPrereleaseAppVersion('1.5.0')).toBe(false)
|
|
expect(isPerfPrereleaseAppVersion('1.5.0-rc.1.perf')).toBe(true)
|
|
expect(isPerfPrereleaseAppVersion('1.5.0-rc.1')).toBe(false)
|
|
})
|
|
})
|
|
|
|
describe('parseCliVersion', () => {
|
|
it.each([
|
|
['2.1.261 (Claude Code)', '2.1.261'],
|
|
['agy version 1.1.11\n', '1.1.11'],
|
|
['v1.1.10 (darwin arm64)', '1.1.10'],
|
|
['1.1.11-rc.1', '1.1.11-rc.1'],
|
|
['agy 1.2.4+build.7', '1.2.4+build.7']
|
|
])('reads %j as %s', (output, expected) => {
|
|
expect(parseCliVersion(output)).toBe(expected)
|
|
})
|
|
|
|
it.each([
|
|
'',
|
|
'agy',
|
|
'version unknown',
|
|
'agy version 1.1.11.0',
|
|
'agy version 1.1.11-',
|
|
'agy version 1.1.11+',
|
|
null,
|
|
undefined
|
|
])('returns null for %j', (output) => {
|
|
expect(parseCliVersion(output)).toBeNull()
|
|
})
|
|
})
|