diff --git a/core/src/local/store.rs b/core/src/local/store.rs index 496dcba..e0923a3 100644 --- a/core/src/local/store.rs +++ b/core/src/local/store.rs @@ -1083,7 +1083,11 @@ mod tests { .into_iter() .map(|t| t.title) .collect(); - assert_eq!(names, vec!["milk".to_string()], "trash has no place in the palette"); + assert_eq!( + names, + vec!["milk".to_string()], + "trash has no place in the palette" + ); } // ---- the board query ------------------------------------------------------- @@ -1102,9 +1106,27 @@ mod tests { // The facets bind positionally, so a text facet that binds the wrong number // of values shifts every bound after it — this pairs it with one. let conn = db(); - stamped(&conn, "old", "milk", "2026-01-01T00:00:00.000Z", "2026-01-01T00:00:00.000Z"); - stamped(&conn, "new", "milk", "2026-07-01T00:00:00.000Z", "2026-07-01T00:00:00.000Z"); - stamped(&conn, "other", "eggs", "2026-07-01T00:00:00.000Z", "2026-07-01T00:00:00.000Z"); + stamped( + &conn, + "old", + "milk", + "2026-01-01T00:00:00.000Z", + "2026-01-01T00:00:00.000Z", + ); + stamped( + &conn, + "new", + "milk", + "2026-07-01T00:00:00.000Z", + "2026-07-01T00:00:00.000Z", + ); + stamped( + &conn, + "other", + "eggs", + "2026-07-01T00:00:00.000Z", + "2026-07-01T00:00:00.000Z", + ); let found = list( &conn, json!({"view": "notes", "facets": {"q": "milk", "created_after": "2026-06-01T00:00:00.000Z"}}), @@ -1129,7 +1151,7 @@ mod tests { let both = note(&conn, "both"); let one = note(&conn, "one"); set_labels(&conn, &both.id, &[home.id.clone(), work.id.clone()]).expect("labels"); - set_labels(&conn, &one.id, &[home.id.clone()]).expect("labels"); + set_labels(&conn, &one.id, std::slice::from_ref(&home.id)).expect("labels"); let found = list( &conn, @@ -1144,17 +1166,27 @@ mod tests { let reminded = note(&conn, "reminded"); let attached = note(&conn, "attached"); note(&conn, "plain"); - update_note(&conn, &reminded.id, &json!({"remind_at": "2026-12-01T09:00:00.000Z"})) - .expect("remind"); + update_note( + &conn, + &reminded.id, + &json!({"remind_at": "2026-12-01T09:00:00.000Z"}), + ) + .expect("remind"); conn.execute( "INSERT INTO attachments (id, note_id, url) VALUES ('a', ?1, '/x')", [&attached.id], ) .expect("attach"); - let r = list(&conn, json!({"view": "notes", "facets": {"has_reminder": true}})); + let r = list( + &conn, + json!({"view": "notes", "facets": {"has_reminder": true}}), + ); assert_eq!(ids(&r), vec![reminded.id.as_str()]); - let a = list(&conn, json!({"view": "notes", "facets": {"has_attachment": true}})); + let a = list( + &conn, + json!({"view": "notes", "facets": {"has_attachment": true}}), + ); assert_eq!(ids(&a), vec![attached.id.as_str()]); } @@ -1167,12 +1199,18 @@ mod tests { update_note(&conn, &archived.id, &json!({"archived": true})).expect("archive"); trash(&conn, &trashed.id).expect("trash"); - assert_eq!(ids(&list(&conn, json!({"view": "notes"}))), vec![kept.id.as_str()]); + assert_eq!( + ids(&list(&conn, json!({"view": "notes"}))), + vec![kept.id.as_str()] + ); assert_eq!( ids(&list(&conn, json!({"view": "archived"}))), vec![archived.id.as_str()] ); - assert_eq!(ids(&list(&conn, json!({"view": "trash"}))), vec![trashed.id.as_str()]); + assert_eq!( + ids(&list(&conn, json!({"view": "trash"}))), + vec![trashed.id.as_str()] + ); } #[test] @@ -1196,8 +1234,20 @@ mod tests { #[test] fn sort_created_orders_by_birth_not_by_edit() { let conn = db(); - stamped(&conn, "older", "a", "2026-01-01T00:00:00.000Z", "2026-09-01T00:00:00.000Z"); - stamped(&conn, "newer", "b", "2026-05-01T00:00:00.000Z", "2026-05-01T00:00:00.000Z"); + stamped( + &conn, + "older", + "a", + "2026-01-01T00:00:00.000Z", + "2026-09-01T00:00:00.000Z", + ); + stamped( + &conn, + "newer", + "b", + "2026-05-01T00:00:00.000Z", + "2026-05-01T00:00:00.000Z", + ); let found = list(&conn, json!({"view": "notes", "sort": "created"})); assert_eq!(ids(&found), vec!["newer", "older"]); } @@ -1223,7 +1273,10 @@ mod tests { assert_eq!(n.body, "milk"); assert_eq!(n.labels.len(), 1); assert_eq!(n.labels[0].name, "groceries"); - assert!(!n.labels[0].via_tag, "nothing in the body backs it any more"); + assert!( + !n.labels[0].via_tag, + "nothing in the body backs it any more" + ); } #[test] @@ -1315,8 +1368,12 @@ mod tests { fn completing_a_one_off_reminder_clears_it() { let conn = db(); let n = note(&conn, "once"); - update_note(&conn, &n.id, &json!({"remind_at": "2026-01-01T09:00:00.000Z"})) - .expect("remind"); + update_note( + &conn, + &n.id, + &json!({"remind_at": "2026-01-01T09:00:00.000Z"}), + ) + .expect("remind"); let done = complete_reminder(&conn, &n.id).expect("complete"); assert!(done.remind_at.is_none()); assert!(done.recurrence.is_none()); @@ -1345,12 +1402,24 @@ mod tests { let later = note(&conn, "later"); let sooner = note(&conn, "sooner"); let binned = note(&conn, "binned"); - update_note(&conn, &later.id, &json!({"remind_at": "2026-12-02T09:00:00.000Z"})) - .expect("remind"); - update_note(&conn, &sooner.id, &json!({"remind_at": "2026-12-01T09:00:00.000Z"})) - .expect("remind"); - update_note(&conn, &binned.id, &json!({"remind_at": "2026-11-01T09:00:00.000Z"})) - .expect("remind"); + update_note( + &conn, + &later.id, + &json!({"remind_at": "2026-12-02T09:00:00.000Z"}), + ) + .expect("remind"); + update_note( + &conn, + &sooner.id, + &json!({"remind_at": "2026-12-01T09:00:00.000Z"}), + ) + .expect("remind"); + update_note( + &conn, + &binned.id, + &json!({"remind_at": "2026-11-01T09:00:00.000Z"}), + ) + .expect("remind"); trash(&conn, &binned.id).expect("trash"); assert_eq!( ids(&reminders(&conn).expect("reminders")), @@ -1366,7 +1435,7 @@ mod tests { let work = create_label(&conn, "work").expect("label"); let jobs = create_label(&conn, "jobs").expect("label"); let n = note(&conn, "task"); - set_labels(&conn, &n.id, &[jobs.id.clone()]).expect("labels"); + set_labels(&conn, &n.id, std::slice::from_ref(&jobs.id)).expect("labels"); let survivor = rename_label(&conn, &jobs.id, "Work").expect("rename"); assert_eq!(survivor.id, work.id); @@ -1383,8 +1452,8 @@ mod tests { let home = create_label(&conn, "home").expect("label"); let kept = note(&conn, "kept"); let binned = note(&conn, "binned"); - set_labels(&conn, &kept.id, &[home.id.clone()]).expect("labels"); - set_labels(&conn, &binned.id, &[home.id.clone()]).expect("labels"); + set_labels(&conn, &kept.id, std::slice::from_ref(&home.id)).expect("labels"); + set_labels(&conn, &binned.id, std::slice::from_ref(&home.id)).expect("labels"); trash(&conn, &binned.id).expect("trash"); assert_eq!(list_labels(&conn).expect("labels")[0].count, Some(1)); }