style: cargo fmt --all
This commit is contained in:
@@ -1,18 +1,21 @@
|
||||
use std::sync::Arc;
|
||||
use application::testing::InMemoryAlbumRepository;
|
||||
use application::organization::{CreateAlbumCommand, CreateAlbumHandler};
|
||||
use application::testing::InMemoryAlbumRepository;
|
||||
use domain::errors::DomainError;
|
||||
use domain::value_objects::SystemId;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[tokio::test]
|
||||
async fn creates_album() {
|
||||
let repo = Arc::new(InMemoryAlbumRepository::new());
|
||||
let handler = CreateAlbumHandler::new(repo);
|
||||
let creator = SystemId::new();
|
||||
let album = handler.execute(CreateAlbumCommand {
|
||||
title: "Vacation 2024".into(),
|
||||
creator_id: creator,
|
||||
}).await.unwrap();
|
||||
let album = handler
|
||||
.execute(CreateAlbumCommand {
|
||||
title: "Vacation 2024".into(),
|
||||
creator_id: creator,
|
||||
})
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(album.title, "Vacation 2024");
|
||||
assert_eq!(album.creator_user_id, creator);
|
||||
assert_eq!(album.asset_count(), 0);
|
||||
@@ -22,9 +25,11 @@ async fn creates_album() {
|
||||
async fn rejects_empty_title() {
|
||||
let repo = Arc::new(InMemoryAlbumRepository::new());
|
||||
let handler = CreateAlbumHandler::new(repo);
|
||||
let result = handler.execute(CreateAlbumCommand {
|
||||
title: "".into(),
|
||||
creator_id: SystemId::new(),
|
||||
}).await;
|
||||
let result = handler
|
||||
.execute(CreateAlbumCommand {
|
||||
title: "".into(),
|
||||
creator_id: SystemId::new(),
|
||||
})
|
||||
.await;
|
||||
assert!(matches!(result, Err(DomainError::Validation(_))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user