add 400+ unit tests for domain and application layers
Some checks failed
CI / Check / Test (push) Has been cancelled
Some checks failed
CI / Check / Test (push) Has been cancelled
Extract ReviewLogger trait to decouple import/integrations from diary::log_review (cross-module coupling smell). Add in-memory fakes for all repository ports, enabling isolated testing of every use case module without a database. Coverage: domain+application 22% → 80%, 427 tests.
This commit is contained in:
22
crates/application/src/auth/tests/register_and_login.rs
Normal file
22
crates/application/src/auth/tests/register_and_login.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use crate::auth::commands::RegisterAndLoginCommand;
|
||||
use crate::auth::register_and_login;
|
||||
use crate::test_helpers::TestContextBuilder;
|
||||
|
||||
#[tokio::test]
|
||||
async fn registers_and_returns_token() {
|
||||
let ctx = TestContextBuilder::new().build();
|
||||
|
||||
let result = register_and_login::execute(
|
||||
&ctx,
|
||||
RegisterAndLoginCommand {
|
||||
email: "new@example.com".into(),
|
||||
username: "newuser".into(),
|
||||
password: "password123".into(),
|
||||
},
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
assert!(!result.token.is_empty());
|
||||
assert_eq!(result.email, "new@example.com");
|
||||
}
|
||||
Reference in New Issue
Block a user