mirror of
https://github.com/stablyai/orca.git
synced 2026-10-30 16:47:34 +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>
43 lines
1.6 KiB
JavaScript
43 lines
1.6 KiB
JavaScript
import { describe, expect, it } from 'vitest'
|
|
import {
|
|
BUILD_IDENTITY_RE,
|
|
MINIFIED_TELEMETRY_RE,
|
|
WRITE_KEY_RE
|
|
} from './telemetry-bundle-constant-patterns.mjs'
|
|
|
|
describe('telemetry bundle constant patterns', () => {
|
|
it.each(['const', 'let', 'var'])('accepts %s declarations', (declaration) => {
|
|
expect(BUILD_IDENTITY_RE.exec(`${declaration} BUILD_IDENTITY = "rc"`)?.[1]).toBe('rc')
|
|
expect(WRITE_KEY_RE.exec(`${declaration} WRITE_KEY = "phc_example-key_123"`)?.[1]).toBe(
|
|
'phc_example-key_123'
|
|
)
|
|
})
|
|
|
|
it('rejects assignments and invalid values', () => {
|
|
expect('BUILD_IDENTITY = "rc"').not.toMatch(BUILD_IDENTITY_RE)
|
|
expect('const BUILD_IDENTITY = "dev"').not.toMatch(BUILD_IDENTITY_RE)
|
|
expect('const WRITE_KEY = null').not.toMatch(WRITE_KEY_RE)
|
|
expect('const WRITE_KEY = "example-key"').not.toMatch(WRITE_KEY_RE)
|
|
})
|
|
|
|
it('accepts minified adjacent declarations', () => {
|
|
const bundle = 'var dde=`stable`,fde=`phc_example-key_123`,pde=(dde===`stable`)'
|
|
expect(MINIFIED_TELEMETRY_RE.exec(bundle)?.slice(1, 3)).toEqual([
|
|
'stable',
|
|
'phc_example-key_123'
|
|
])
|
|
})
|
|
|
|
it('accepts the identity as a later declarator in a shared declaration', () => {
|
|
const bundle = 'var wpe=!0,Tpe=`stable`,Epe=`phc_example-key_123`,Dpe=(Tpe===`stable`)'
|
|
expect(MINIFIED_TELEMETRY_RE.exec(bundle)?.slice(1, 3)).toEqual([
|
|
'stable',
|
|
'phc_example-key_123'
|
|
])
|
|
})
|
|
|
|
it('rejects a minified identity with no adjacent write key', () => {
|
|
expect('var a=!0,b=`stable`,c=null').not.toMatch(MINIFIED_TELEMETRY_RE)
|
|
})
|
|
})
|