M12 — the Android client, end to end #2

Merged
bvandeusen merged 86 commits from dev into main 2026-08-21 08:53:58 -04:00
Showing only changes of commit 7d9a6509f3 - Show all commits
+16 -4
View File
@@ -148,7 +148,10 @@ mod tests {
set_link(&conn, "https://notes.example.com", "tok-1").expect("link"); set_link(&conn, "https://notes.example.com", "tok-1").expect("link");
let state = read(&conn).expect("read"); let state = read(&conn).expect("read");
assert!(state.is_linked()); assert!(state.is_linked());
assert_eq!(state.server_url.as_deref(), Some("https://notes.example.com")); assert_eq!(
state.server_url.as_deref(),
Some("https://notes.example.com")
);
assert_eq!(state.device_token.as_deref(), Some("tok-1")); assert_eq!(state.device_token.as_deref(), Some("tok-1"));
} }
@@ -160,7 +163,10 @@ mod tests {
// e.g. the token was revoked and the user re-authenticated. // e.g. the token was revoked and the user re-authenticated.
set_link(&conn, "https://a.example.com", "tok-2").expect("relink"); set_link(&conn, "https://a.example.com", "tok-2").expect("relink");
let state = read(&conn).expect("read"); let state = read(&conn).expect("read");
assert_eq!(state.last_cursor, 4242, "a re-auth shouldn't force a full re-sync"); assert_eq!(
state.last_cursor, 4242,
"a re-auth shouldn't force a full re-sync"
);
assert_eq!(state.device_token.as_deref(), Some("tok-2")); assert_eq!(state.device_token.as_deref(), Some("tok-2"));
} }
@@ -217,7 +223,10 @@ mod tests {
#[test] #[test]
fn unparseable_cursor_falls_back_to_a_full_sync() { fn unparseable_cursor_falls_back_to_a_full_sync() {
let conn = db(); let conn = db();
conn.execute("UPDATE sync_state SET last_cursor = 'garbage' WHERE id = 1", []) conn.execute(
"UPDATE sync_state SET last_cursor = 'garbage' WHERE id = 1",
[],
)
.expect("bad cursor"); .expect("bad cursor");
assert_eq!(read(&conn).expect("read").last_cursor, 0); assert_eq!(read(&conn).expect("read").last_cursor, 0);
} }
@@ -227,7 +236,10 @@ mod tests {
let conn = db(); let conn = db();
set_link(&conn, "https://a.example.com", "super-secret").expect("link"); set_link(&conn, "https://a.example.com", "super-secret").expect("link");
let json = serde_json::to_string(&status(&conn).expect("status")).expect("serialize"); let json = serde_json::to_string(&status(&conn).expect("status")).expect("serialize");
assert!(!json.contains("super-secret"), "token leaked to the webview: {json}"); assert!(
!json.contains("super-secret"),
"token leaked to the webview: {json}"
);
assert!(json.contains("\"linked\":true"), "got {json}"); assert!(json.contains("\"linked\":true"), "got {json}");
} }
} }