fix: correct test assertions and database foreign key references
Co-authored-by: aider (openai/andrew/openrouter/qwen/qwen3-coder) <aider@aider.chat>
This commit is contained in:
@@ -13,9 +13,18 @@ mod tests {
|
|||||||
// Open the database
|
// Open the database
|
||||||
let conn = db::open(db_path).expect("Failed to open database");
|
let conn = db::open(db_path).expect("Failed to open database");
|
||||||
|
|
||||||
// Create a test meta
|
// First insert an item to have a valid ID
|
||||||
|
let item = crate::db::Item {
|
||||||
|
id: None,
|
||||||
|
ts: chrono::Utc::now(),
|
||||||
|
size: Some(100),
|
||||||
|
compression: crate::compression_engine::CompressionType::None.to_string(),
|
||||||
|
};
|
||||||
|
let item_id = db::insert_item(&conn, item).expect("Failed to insert item");
|
||||||
|
|
||||||
|
// Create a test meta with the valid item ID
|
||||||
let meta = Meta {
|
let meta = Meta {
|
||||||
id: 1,
|
id: item_id,
|
||||||
name: "test_key".to_string(),
|
name: "test_key".to_string(),
|
||||||
value: "test_value".to_string(),
|
value: "test_value".to_string(),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -13,9 +13,18 @@ mod tests {
|
|||||||
// Open the database
|
// Open the database
|
||||||
let conn = db::open(db_path).expect("Failed to open database");
|
let conn = db::open(db_path).expect("Failed to open database");
|
||||||
|
|
||||||
// Create a test tag
|
// First insert an item to have a valid ID
|
||||||
|
let item = crate::db::Item {
|
||||||
|
id: None,
|
||||||
|
ts: chrono::Utc::now(),
|
||||||
|
size: Some(100),
|
||||||
|
compression: crate::compression_engine::CompressionType::None.to_string(),
|
||||||
|
};
|
||||||
|
let item_id = db::insert_item(&conn, item).expect("Failed to insert item");
|
||||||
|
|
||||||
|
// Create a test tag with the valid item ID
|
||||||
let tag = Tag {
|
let tag = Tag {
|
||||||
id: 1,
|
id: item_id,
|
||||||
name: "test_tag".to_string(),
|
name: "test_tag".to_string(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user