Crate wireframe_testing

Crate wireframe_testing 

Source
Expand description

Utilities for driving a WireframeApp with in-memory streams during tests.

These helpers spawn the application on a tokio::io::duplex stream and return all bytes written by the app for easy assertions. They work with any message implementing [serde::Serialize]. The payload is encoded with bincode::encode_to_vec using bincode::config::standard(), which means little-endian byte order, variable-length integer encoding and no byte limit are applied. The example uses a simple u8 value so no generics are required.

use wireframe::app::WireframeApp;
use wireframe_testing::drive_with_bincode;

let bytes = drive_with_bincode(app, 42u8).await.unwrap();

Re-exports§

pub use helpers::TEST_MAX_FRAME;
pub use helpers::TestSerializer;
pub use helpers::decode_frames;
pub use helpers::decode_frames_with_max;
pub use helpers::drive_with_bincode;
pub use helpers::drive_with_frame;
pub use helpers::drive_with_frame_mut;
pub use helpers::drive_with_frame_with_capacity;
pub use helpers::drive_with_frames;
pub use helpers::drive_with_frames_mut;
pub use helpers::drive_with_frames_with_capacity;
pub use helpers::encode_frame;
pub use helpers::new_test_codec;
pub use helpers::run_app;
pub use helpers::run_with_duplex_server;
pub use logging::LoggerHandle;
pub use logging::logger;
pub use logging::logger;

Modules§

helpers
Helper utilities for driving WireframeApp instances in tests.
logging
Logging utilities for test infrastructure.
multi_packet
Helpers for draining Response::MultiPacket values in tests.

Macros§

push_expect
Await the provided future and panic with context on failure.
recv_expect
Await the provided future and panic with context on failure.

Functions§

collect_multi_packet
Collect all frames from a Response::MultiPacket.