also looking at this
feat: expose owned VTOL transition simulation through native CLI
#82
20 files
+743
-36
| @@ -1,6 +1,19 @@ | ||
| 1 | 1 | import { expect, test } from 'bun:test' |
| 2 | 2 | import { command } from '@stacksjs/testing' |
| 3 | 3 | |
| 4 | test('CI runs every standalone VTOL qualification outside the checkout', async () => { | |
| 5 | const workflow = Bun.YAML.parse(await Bun.file(new URL('../../.github/workflows/ci.yml', import.meta.url)).text()) as { | |
| 6 | jobs: { check: { steps: { run?: string, 'working-directory'?: string }[] } } | |
| 7 | } | |
| 8 | const steps = workflow.jobs.check.steps.filter(step => step.run?.startsWith('$GITHUB_WORKSPACE/storage/runtime-build/cli/drone vtol:hover')) | |
| 9 | expect(steps.map(step => ({ command: step.run, directory: step['working-directory'] }))).toEqual([ | |
| 10 | { command: '$GITHUB_WORKSPACE/storage/runtime-build/cli/drone vtol:hover', directory: '${{ runner.temp }}' }, | |
| 11 | { command: '$GITHUB_WORKSPACE/storage/runtime-build/cli/drone vtol:hover --scenario host-loss', directory: '${{ runner.temp }}' }, | |
| 12 | { command: '$GITHUB_WORKSPACE/storage/runtime-build/cli/drone vtol:hover --electrical', directory: '${{ runner.temp }}' }, | |
| 13 | { command: '$GITHUB_WORKSPACE/storage/runtime-build/cli/drone vtol:hover --scenario host-loss --electrical', directory: '${{ runner.temp }}' }, | |
| 14 | ]) | |
| 15 | }) | |
| 16 | ||
| 4 | 17 | test('native VTOL hover command preserves nominal and lost-host outcomes with explicit development scope', async () => { |
| 5 | 18 | for (const [scenario, status] of [['hover', 'completed'], ['host-loss', 'host-lost']]) { |
| 6 | 19 | const result = await command(['vtol:hover', '--scenario', scenario!]).withTimeout(60000) |
| @@ -29,3 +42,23 @@ test('native VTOL command rejects unknown scenarios and preserves insufficient-d | ||
| 29 | 42 | expect(report.mission.state).toBe('running') |
| 30 | 43 | expect(report.board.actuators).toEqual([0, 0, 0, 0, 0, 0, 0, 0]) |
| 31 | 44 | }, 180000) |
| 45 | ||
| 46 | test('native VTOL electrical option preserves hover and host-loss scope with measured battery evidence', async () => { | |
| 47 | for (const scenario of ['hover', 'host-loss']) { | |
| 48 | const result = await command(['vtol:hover', '--scenario', scenario, '--electrical']).withTimeout(60000) | |
| 49 | expect(result.exitCode).toBe(0) | |
| 50 | const report = JSON.parse(result.stdout) | |
| 51 | expect(report.demonstrationMatched).toBe(true) | |
| 52 | expect(report.energy.evidence).toBe('modeled-vehicle-battery-v1') | |
| 53 | expect(report.energy.model).toEqual({ evidence: 'modeled-vehicle-battery-v1', capacityWh: 50, maximumSourceW: 1061 }) | |
| 54 | expect(report.energy.lastObservation.energyUsedWh).toBeGreaterThan(0) | |
| 55 | expect(report.energy.lastObservation.capturedAtMs).toBeLessThan(report.energy.lastObservation.observedAtMs) | |
| 56 | expect(report.scope).toBe('development-hover-only') | |
| 57 | expect(report.physicalFlightEnabled).toBe(false) | |
| 58 | expect(report.board.actuators).toEqual([0, 0, 0, 0, 0, 0, 0, 0]) | |
| 59 | if (scenario === 'host-loss') { | |
| 60 | expect(report.energy.lastObservation.observedAtMs).toBe(2980) | |
| 61 | expect(report.board.fault).toBe('output-lease-expired') | |
| 62 | } | |
| 63 | } | |
| 64 | }, 180000) | |