Expand description
Framework-style test harness for Sova.
SqliteTestDb— tempfile sqlite + migrateTestApp— App bootstrap with Db + pluginsResponseAssert/assert_json_snapshot— uniform response checks
Auth helpers (acting_as, user factories) live in [sova_auth::testing].
Notification acting_as_id lives in [sova_notifications::testing].
ⓘ
use sova_testing::{ResponseAssert, TestApp, assert_json_snapshot};
use sova_notifications::testing::ActingAs;
let (_db, app) = TestApp::builder()
.migrator::<NotificationsMigrator>()
.install(Notifications::new().mount("/notifications"))
.build()
.await;
let c = TestClient::tracked(app).await.unwrap();
c.acting_as_id(1);
let res = c.get("/notifications").await;
res.assert_status(200);
assert_json_snapshot!("inbox", res.json_value());Macros§
- assert_
json_ snapshot - Assert JSON snapshot with common redactions (
id, timestamps).
Structs§
- Sqlite
Test Db - Isolated sqlite file + URL. Keeps
TempDiralive for the test duration. - TestApp
- Fluent bootstrap: migrate sqlite, install
Db+ plugins,run_startup. - Test
AppBuilder
Traits§
- Response
Assert - Fluent assertions for HTTP responses in tests.
Functions§
- apply_
migrations - Run each migration’s
up(for tests). Prefer unique [MigrationName]s soMigratorTrait::up/migrateCLI also work on composed migrators. - with_
json_ redactions - Redact volatile fields commonly present in API JSON.