Module testing

Module testing 

Source
Expand description

Testing utilities for Kit framework

Provides Jest-like testing helpers including:

  • expect! macro for fluent assertions with clear expected/received output
  • describe! and test! macros for test organization
  • TestDatabase for isolated database tests
  • TestContainer for dependency injection in tests

§Example

use kit::{describe, test, expect};
use kit::testing::TestDatabase;

describe!("UserService", {
    test!("creates a user", async fn(db: TestDatabase) {
        let service = UserService::new();
        let user = service.create("test@example.com").await.unwrap();

        expect!(user.email).to_equal("test@example.com".to_string());
    });
});

Re-exports§

pub use crate::container::testing::TestContainer;
pub use crate::container::testing::TestContainerGuard;
pub use crate::database::testing::TestDatabase;

Structs§

Expect
The main Expect wrapper for fluent assertions

Functions§

set_current_test_name
Set the current test name (called by test! macro)