Skip to main content

Module testing

Module testing 

Source
Expand description

View fixtures for a sibling crate’s tests.

A ViewSurface only ever comes off an Arc<Workspace>, and the constructors that build one without a real machine are behind forge-workspace’s own test features. A crate testing a view would otherwise have to name that crate in its manifest to get one; this module is the way round, kept behind its own testing feature so a production build never sees it.

Every constructor here hands back its failure rather than panicking, so a caller that wants a panic is the one that asks for it.

Re-exportsΒ§

use std::path::Path; πŸ”’
use std::sync::Arc; πŸ”’
use forge_primitives::SessionSlot; πŸ”’
use forge_primitives::tasks::Task; πŸ”’
use forge_primitives::tasks::TaskStatus; πŸ”’
use forge_primitives::CronEntry; πŸ”’
use forge_primitives::CronId; πŸ”’
use forge_primitives::CronKind; πŸ”’
use forge_workspace::ProjectKey; πŸ”’
use forge_workspace::Workspace; πŸ”’
use tokio::sync::mpsc; πŸ”’
use crate::SessionUpdate; πŸ”’
use crate::surface::PendingKind; πŸ”’
use crate::surface::ViewSurface; πŸ”’
use crate::transport::TransportState; πŸ”’

StructsΒ§

Fleet
A view surface over a stub workspace, plus the seeding a test needs to put a roster in front of it.
ViewFacts
The facts a session holds that no update stream carries, for a view’s fixture to seed. Every field is what the session reports: leaving one out is a session that has not reported it.

ConstantsΒ§

SEEDED_SESSION πŸ”’
The session id a seeded transcript belongs to. One per fleet is enough: a test that needs two reads two slots against their own files.

FunctionsΒ§

config πŸ”’
The forge.toml a fleet is built from: one [[orgs]] per entry, each project under its own directory so two projects never share a path.

Type AliasesΒ§

FixtureError
What a fixture hands back when it cannot build what was asked for.