typeduck-codex-web 0.4.0

A standalone browser interface and Codex runtime
Documentation
use serde_json::json;
use topcoat::context::Cx;

use super::DashboardDocumentData;
use super::dashboard_document;
use crate::dashboard::Project;

#[tokio::test]
async fn renders_dashboard_with_projects_sessions_and_onboarding() {
    let cx = Cx::default();
    let threads = json!([
        {
            "id": "thread-1",
            "cwd": "/srv/work/codex",
            "preview": "Improve the web dashboard",
            "recencyAt": 1720000000,
            "status": { "type": "active" }
        },
        {
            "id": "thread-2",
            "cwd": "/srv/work/typeduck",
            "preview": "Package the standalone binary",
            "recencyAt": 1710000000,
            "status": { "type": "idle" }
        }
    ]);
    let projects = vec![Project {
        cwd: "/srv/work/codex".to_string(),
        name: "codex".to_string(),
        latest_thread: threads[0].clone(),
        session_count: 3,
    }];
    let view = dashboard_document(
        &cx,
        DashboardDocumentData {
            base_path: "/i/instance",
            projects: &projects,
            threads: threads.as_array().expect("threads"),
            account: None,
            truncated: false,
            profile_label: "Primary",
            proxy_active: true,
        },
    )
    .await
    .expect("render dashboard");

    insta::assert_snapshot!(view.render(&cx));
}