mirror of
https://github.com/stablyai/orca.git
synced 2026-11-19 04:23:57 +00:00
* refactor(mobile): give relay and encryption concrete owners * refactor(mobile): organize session and review feature owners * refactor(mobile): organize RPC and host ownership * test(mobile): point render fixtures at concrete owners * refactor(mobile): use explicit type-only owner imports
36 lines
1.2 KiB
TypeScript
36 lines
1.2 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { getReportableConnectionIncidentId } from './connection-diagnostics-analysis'
|
|
import type { ConnectionLogEntry } from './connection/connection-log-types'
|
|
|
|
function event(message: string, detail?: string): ConnectionLogEntry {
|
|
return { id: message, ts: 1, level: 'error', message, detail }
|
|
}
|
|
|
|
describe('diagnoseConnection', () => {
|
|
it('keys reportability to the current structured incident', () => {
|
|
const args = {
|
|
endpoint: 'ws://192.168.1.2:6768',
|
|
state: 'reconnecting' as const,
|
|
activePath: 'relay' as const,
|
|
entries: [
|
|
{ ...event('Authenticated'), code: 'direct-connected' as const, path: 'lan' as const },
|
|
{
|
|
...event('Relay health check failed'),
|
|
id: 'current-relay-failure',
|
|
ts: 2,
|
|
code: 'liveness-timeout' as const,
|
|
path: 'relay' as const
|
|
}
|
|
]
|
|
}
|
|
|
|
expect(getReportableConnectionIncidentId(args)).toBe('current-relay-failure')
|
|
expect(
|
|
getReportableConnectionIncidentId({
|
|
...args,
|
|
entries: [...args.entries, { ...event('Network changed'), ts: 3, code: 'network-changed' }]
|
|
})
|
|
).toBeNull()
|
|
})
|
|
})
|