pinakes-core: add database atomicity tests for DB operations

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I154fe8dc67c56fd21a734d1f984760bf6a6a6964
This commit is contained in:
raf 2026-02-09 15:38:45 +03:00
commit 95527e4bca
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
2 changed files with 260 additions and 0 deletions

View file

@ -97,3 +97,41 @@ pub fn create_test_media_item(path: PathBuf, hash: &str) -> MediaItem {
links_extracted_at: None,
}
}
/// Create a test markdown media item with a given ID
pub fn make_test_markdown_item(id: MediaId) -> MediaItem {
let now = chrono::Utc::now();
MediaItem {
id,
path: format!("/tmp/test_{}.md", id.0).into(),
file_name: format!("test_{}.md", id.0),
media_type: MediaType::Builtin(BuiltinMediaType::Markdown),
content_hash: ContentHash::new(format!("hash_{}", id.0)),
file_size: 1024,
title: Some("Test Note".to_string()),
artist: None,
album: None,
genre: None,
year: None,
duration_secs: None,
description: Some("Test markdown note".to_string()),
thumbnail_path: None,
custom_fields: HashMap::new(),
file_mtime: None,
date_taken: None,
latitude: None,
longitude: None,
camera_make: None,
camera_model: None,
rating: None,
perceptual_hash: None,
storage_mode: StorageMode::External,
original_filename: None,
uploaded_at: None,
storage_key: None,
created_at: now,
updated_at: now,
deleted_at: None,
links_extracted_at: None,
}
}