Skip to content

armgit / orca

Public Imported from GitHub
0

Orca is the place for working with a fleet of agents (e.g. Grok Bot, Claude Code). Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

1.3 KB
Raw Blame
import { describe, expect, it } from 'vitest'
import type { MobileWebShellSessionState } from './mobile-web-shell-session-contract'
import { shellPageFrame } from './shell-page-frame'

const READY: MobileWebShellSessionState = {
  kind: 'ready',
  generationDirectory: '/cache/gen',
  sessionId: 'session-a',
  buildId: 'build-a',
  totalBytes: 1,
  elapsedMs: 1
}

function frame(patch: { state?: MobileWebShellSessionState; pagePainted?: boolean }) {
  return shellPageFrame({ state: patch.state ?? READY, pagePainted: patch.pagePainted ?? false })
}

describe('how long the shell keeps its own frame up', () => {
  it('has nothing to cover before a generation is on screen', () => {
    for (const state of [
      { kind: 'checking' },
      { kind: 'activating', source: 'download' },
      { kind: 'offline' },
      { kind: 'route-unavailable' }
    ] as const satisfies readonly MobileWebShellSessionState[]) {
      expect(frame({ state }), state.kind).toBe('pending')
    }
  })

  it('covers a mounted view until the page reports a frame, handshake or not', () => {
    // Ready precedes tree construction; keep the cover over the empty view until paint.
    expect(frame({})).toBe('unpainted')
  })

  it('uncovers on the page reporting a frame', () => {
    expect(frame({ pagePainted: true })).toBe('painted')
  })
})