mirror of
https://github.com/stablyai/orca.git
synced 2026-11-01 09:37:33 +00:00
* test: strengthen launch, subject identity, and release witnesses * test: strengthen approval paths and prompt answer boundaries * test: strengthen conversation names and mobile log persistence * refactor: group background task stop contract with stop operations * test: strengthen question, title, and release validation * test: distinguish row text and generated dispatch titles * test: verify mobile revival events and retry exclusivity * test: reject incomplete child row output assertions * test: verify copied modules and option selection contracts * test: verify mobile host state and status retry boundaries * test: observe connector refusals and real diagnostic delivery * test: consolidate platform memory coverage and verify bounded work * test: allow cached legacy failure reads within work bounds * test: verify packaging boundaries with independent fixtures --------- Co-authored-by: OrcaWin <293788423+OrcaWin@users.noreply.github.com>
143 lines
4.1 KiB
JavaScript
143 lines
4.1 KiB
JavaScript
import { afterEach, describe, expect, it, vi } from 'vitest'
|
|
import {
|
|
extractManifestAssetNames,
|
|
getRequiredReleaseAssetNames,
|
|
verifyRequiredReleaseAssets
|
|
} from './verify-release-required-assets.mjs'
|
|
|
|
function jsonResponse(body) {
|
|
return {
|
|
ok: true,
|
|
status: 200,
|
|
statusText: 'OK',
|
|
json: vi.fn(async () => body),
|
|
text: vi.fn(async () => (typeof body === 'string' ? body : JSON.stringify(body)))
|
|
}
|
|
}
|
|
|
|
function releaseWithAssets(tag, assetNames) {
|
|
return {
|
|
tag_name: tag,
|
|
draft: true,
|
|
prerelease: false,
|
|
assets: assetNames.map((name, index) => ({
|
|
id: index + 1,
|
|
name,
|
|
state: 'uploaded',
|
|
size: 123
|
|
}))
|
|
}
|
|
}
|
|
|
|
afterEach(() => {
|
|
vi.unstubAllGlobals()
|
|
})
|
|
|
|
describe('getRequiredReleaseAssetNames', () => {
|
|
it('includes both mac updater ZIP names for the tag version', () => {
|
|
expect(getRequiredReleaseAssetNames('v1.4.27')).toEqual(
|
|
expect.arrayContaining([
|
|
'Orca-1.4.27-mac.zip',
|
|
'Orca-1.4.27-mac.zip.blockmap',
|
|
'Orca-1.4.27-arm64-mac.zip',
|
|
'Orca-1.4.27-arm64-mac.zip.blockmap'
|
|
])
|
|
)
|
|
})
|
|
|
|
it('includes x64 and arm64 Linux assets', () => {
|
|
expect(getRequiredReleaseAssetNames('v1.4.27')).toEqual(
|
|
expect.arrayContaining([
|
|
'latest-linux-arm64.yml',
|
|
'orca-linux.AppImage',
|
|
'orca-linux-arm64.AppImage',
|
|
'orca-ide_1.4.27_amd64.deb',
|
|
'orca-ide_1.4.27_arm64.deb',
|
|
'orca-ide-1.4.27.x86_64.rpm',
|
|
'orca-ide-1.4.27.aarch64.rpm'
|
|
])
|
|
)
|
|
})
|
|
})
|
|
|
|
describe('extractManifestAssetNames', () => {
|
|
it('extracts relative and absolute manifest asset names', () => {
|
|
expect(
|
|
extractManifestAssetNames(
|
|
[
|
|
'files:',
|
|
' - url: Orca-1.4.27-arm64-mac.zip',
|
|
' - url: https://example.com/downloads/orca-windows-setup.exe',
|
|
'path: orca-linux.AppImage'
|
|
].join('\n')
|
|
)
|
|
).toEqual(['Orca-1.4.27-arm64-mac.zip', 'orca-windows-setup.exe', 'orca-linux.AppImage'])
|
|
})
|
|
})
|
|
|
|
describe('verifyRequiredReleaseAssets', () => {
|
|
function releaseFetch(release, manifestAsset, manifestText) {
|
|
return vi.fn(async (url) => {
|
|
const releasesUrl = 'https://api.github.com/repos/stablyai/orca/releases'
|
|
if (url === `${releasesUrl}?per_page=100`) {
|
|
return jsonResponse([release])
|
|
}
|
|
if (url === `${releasesUrl}/assets/${manifestAsset.id}`) {
|
|
return jsonResponse(manifestText)
|
|
}
|
|
if (release.assets.some((asset) => url === `${releasesUrl}/assets/${asset.id}`)) {
|
|
return jsonResponse('version: 1.4.27\n')
|
|
}
|
|
throw new Error(`Unexpected release request: ${url}`)
|
|
})
|
|
}
|
|
|
|
it('fails when a manifest-referenced asset has not been uploaded', async () => {
|
|
const tag = 'v1.4.27'
|
|
const release = releaseWithAssets(tag, getRequiredReleaseAssetNames(tag))
|
|
const latestMacAsset = release.assets.find((asset) => asset.name === 'latest-mac.yml')
|
|
vi.stubGlobal(
|
|
'fetch',
|
|
releaseFetch(
|
|
release,
|
|
latestMacAsset,
|
|
[
|
|
'version: 1.4.27',
|
|
'files:',
|
|
' - url: mac-updater-only.zip',
|
|
' sha512: test',
|
|
'path: mac-updater-only.zip'
|
|
].join('\n')
|
|
)
|
|
)
|
|
|
|
await expect(
|
|
verifyRequiredReleaseAssets({ repo: 'stablyai/orca', tag, token: 'token' })
|
|
).rejects.toThrow('Missing: mac-updater-only.zip')
|
|
})
|
|
|
|
it('checks assets referenced by the Linux arm64 updater manifest', async () => {
|
|
const tag = 'v1.4.27'
|
|
const required = getRequiredReleaseAssetNames(tag)
|
|
const release = releaseWithAssets(tag, required)
|
|
const arm64Manifest = release.assets.find((asset) => asset.name === 'latest-linux-arm64.yml')
|
|
vi.stubGlobal(
|
|
'fetch',
|
|
releaseFetch(
|
|
release,
|
|
arm64Manifest,
|
|
[
|
|
'version: 1.4.27',
|
|
'files:',
|
|
' - url: orca-linux-arm64.AppImage.blockmap',
|
|
'path: orca-linux-arm64.AppImage'
|
|
].join('\n')
|
|
)
|
|
)
|
|
|
|
await expect(
|
|
verifyRequiredReleaseAssets({ repo: 'stablyai/orca', tag, token: 'token' })
|
|
).rejects.toThrow('Missing: orca-linux-arm64.AppImage.blockmap')
|
|
})
|
|
})
|