Files
StarPilot/openpilot/starpilot/galaxy/tests/test_connectivity_runtime.mjs
T
firestar5683 80fbb4f6db Feature registration
Register vehicle controls, planner modes, UI actions and Galaxy services after their providers exist. Wire the shared runtime entrypoints and cover their combined behavior.

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: DimitriChrysafis <Dimitri.chrysafis@gmail.com>
Co-authored-by: Dom <168790843+firestar5683@users.noreply.github.com>
Co-authored-by: Harald Schäfer <harald.the.engineer@gmail.com>
Co-authored-by: Kacper Rączy <gfw.kra@gmail.com>
Co-authored-by: Prabhaav Pillai <prabhaav@msu.edu>
Co-authored-by: dirwin31 <83434411+dirwin31@users.noreply.github.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
Co-authored-by: stef <19478336+stefpi@users.noreply.github.com>
Co-authored-by: whoisdomi <dcantu83@gmail.com>

Co-authored-by: Intelli <contact@intelli.software>
Co-authored-by: haraschax <6804392+haraschax@users.noreply.github.com>
Co-authored-by: prabhaavp <prabhaav@msu.edu>
2026-10-14 20:02:39 -05:00

26 lines
1.9 KiB
JavaScript

import assert from 'node:assert/strict'
import { compile } from '../web/vendor/vue/vue.esm-browser.js'
import { OnroadLayoutPage } from '../web/js/onroad-layout.js'
import { BluetoothFeed } from '../web/js/bluetooth.js'
compile(OnroadLayoutPage.template, {decodeEntities: s => s.replaceAll('&amp;', '&')})
assert.deepEqual(OnroadLayoutPage.computed.availableProfiles.call({state:{data:{activeProfile:'compact'}}}), ['compact'])
assert.deepEqual(OnroadLayoutPage.computed.availableProfiles.call({state:{data:{activeProfile:'large'}}}), ['large'])
assert.deepEqual(OnroadLayoutPage.computed.availableProfiles.call({state:{data:{}}}), [])
let selected = null
const vm = {busy:false, dirty:false, state:{drag:null}, $emit(event,target){selected = [event,target]}}
vm.leave = OnroadLayoutPage.methods.leave.bind(vm)
OnroadLayoutPage.methods.requestLeave.call(vm,'projection')
assert.deepEqual(selected,['target','projection'])
assert.ok(OnroadLayoutPage.template.includes('data-preview-source="device-backdrop"'))
assert.ok(!OnroadLayoutPage.template.includes('devicePreviewOpen'))
const status = {version:1,available:true,parked:false,powered:true,discovering:false,errorCode:null,pairing:null,devices:[]}
const calls=[]
const feed = new BluetoothFeed({publish(){},fetcher:async(url,opts)=>{calls.push([url,opts]);return {ok:true,status:200,json:async()=>status}},later(){return 1},cancelTimer(){}})
await feed.start()
for (const [operation, fields] of [['scan',{}], ['pair',{address:'AA:BB:CC:DD:EE:FF'}], ['connect',{address:'AA:BB:CC:DD:EE:FF'}], ['disconnect',{address:'AA:BB:CC:DD:EE:FF'}], ['forget',{address:'AA:BB:CC:DD:EE:FF'}]]) {
const before=calls.length;await feed.action(operation,fields);assert.equal(calls.length,before+2)
}
const before=calls.length;await feed.action('power',{enabled:false});assert.equal(calls.length,before)
feed.stop()
console.log('Actual Vue template, hardware targets, AA target navigation, onroad Bluetooth operations and radio restart gate PASS')