Five test modules wrote the same db() over memory_conn, and portable.rs unwrapped it inline; local::test_db() is that. Four pull/push tests wrote the same label INSERT; local::seed_label(conn, id, name, dirty) is it. Both are cfg(test), beside memory_conn, as wire::sample_note is beside wire::Note. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+3
-15
@@ -508,9 +508,7 @@ pub async fn run(
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
fn db() -> Connection {
|
||||
crate::local::memory_conn().expect("in-memory db")
|
||||
}
|
||||
use crate::local::test_db as db;
|
||||
|
||||
fn note(id: &str, revision: i64) -> wire::Note {
|
||||
wire::sample_note(id, revision)
|
||||
@@ -738,12 +736,7 @@ mod tests {
|
||||
#[test]
|
||||
fn server_label_replaces_a_local_duplicate_by_name() {
|
||||
let conn = db();
|
||||
conn.execute(
|
||||
"INSERT INTO labels (id, name, color, created_at, updated_at, dirty)
|
||||
VALUES ('local-id', 'Work', 'default', '2026-01-01', '2026-01-01', 1)",
|
||||
[],
|
||||
)
|
||||
.expect("seed local label");
|
||||
crate::local::seed_label(&conn, "local-id", "Work", 1);
|
||||
|
||||
let server = wire::Label {
|
||||
id: "server-id".into(),
|
||||
@@ -768,12 +761,7 @@ mod tests {
|
||||
// plain delete would strip the label off them with nothing to repair it.
|
||||
let conn = db();
|
||||
apply_page(&conn, &page(vec![note("n1", 1)], vec![], 1)).expect("seed note");
|
||||
conn.execute(
|
||||
"INSERT INTO labels (id, name, color, created_at, updated_at, dirty)
|
||||
VALUES ('local-id', 'Work', 'default', '2026-01-01', '2026-01-01', 1)",
|
||||
[],
|
||||
)
|
||||
.expect("seed local label");
|
||||
crate::local::seed_label(&conn, "local-id", "Work", 1);
|
||||
conn.execute(
|
||||
"INSERT INTO note_labels (note_id, label_id, via_tag)
|
||||
VALUES ('n1', 'local-id', 0)",
|
||||
|
||||
Reference in New Issue
Block a user