Files
orca/config/scripts/orcad-watcher-package.test.mjs
T
OrcaWin 6fc3cdcad6 Bundle Bun for headless Orca and profile persistence (#22635)
Bundle a pinned, verified Bun runtime for headless Orca so existing Node launch commands can hand off before opening a profile. Keep desktop execution on Electron.

Add the Bun SQLite adapter and terminal backend, bounded shutdown, process inspection and cross-platform artifact qualification. Keep future managed SSH deployment separate from current production launch paths.
2026-09-25 22:49:06 -07:00

41 lines
1.8 KiB
JavaScript

import { createHash } from 'node:crypto'
import { describe, expect, it } from 'vitest'
import {
parseWatcherLockfile,
verifyWatcherArchive,
watcherPackageIdentity
} from './orcad-watcher-package.mjs'
describe('locked watcher release assets', () => {
const archive = Buffer.from('archive')
const integrity = `sha512-${createHash('sha512').update(archive).digest('base64')}`
it('reads dependency pins after the package-manager document in pnpm 12 lockfiles', () => {
const lockfile = parseWatcherLockfile(
`---\npackages: {}\n---\npackages:\n '@parcel/watcher-linux-x64-glibc@2.5.6':\n resolution:\n integrity: ${integrity}\n`
)
expect(watcherPackageIdentity('linux-x64-glibc', '2.5.6', lockfile).integrity).toBe(integrity)
})
it('resolves a target using the exact installed wrapper version and locked integrity', () => {
const lockfile = {
packages: { '@parcel/watcher-linux-x64-musl@2.5.6': { resolution: { integrity } } }
}
expect(watcherPackageIdentity('linux-x64-musl', '2.5.6', lockfile)).toEqual({
integrity,
url: 'https://registry.npmjs.org/@parcel/watcher-linux-x64-musl/-/watcher-linux-x64-musl-2.5.6.tgz'
})
expect(() => watcherPackageIdentity('linux-x64-glibc', '2.5.6', lockfile)).toThrow('lockfile')
expect(() => watcherPackageIdentity('linux-x64-musl', '2.5.7', lockfile)).toThrow('lockfile')
})
it('rejects missing, unknown and corrupted inputs before extraction', () => {
expect(() => watcherPackageIdentity('../x64', '2.5.6', {})).toThrow('Unsupported')
expect(() => verifyWatcherArchive(archive, integrity)).not.toThrow()
expect(() => verifyWatcherArchive(Buffer.from('tampered'), integrity)).toThrow('integrity')
expect(() => verifyWatcherArchive(Buffer.alloc(16 * 1024 * 1024 + 1), integrity)).toThrow(
'size limit'
)
})
})