Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/accshift-app/tests/real_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,11 @@ fn the_pin_session_locks_unlocks_and_guards_the_settings_store() {
.unwrap_err();
assert_eq!(error.message, PIN_LOCKED_MESSAGE);

let wrong = real.pin_unlock("0000").unwrap();
// A code of the wrong length fails before PBKDF2, which takes up to a
// second unoptimized on a slow runner: the retry right after it then
// always lands inside the one second wait, which counts from the start of
// the failed attempt.
let wrong = real.pin_unlock("00").unwrap();
assert_eq!(wrong.status, "invalid");
assert_eq!(wrong.retry_after_ms, 1000);
let too_soon = real.pin_unlock("1234").unwrap();
Expand Down
33 changes: 29 additions & 4 deletions crates/accshift-egui/src/app/tests/native_regressions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,41 @@ fn native_external_storage_on_focus_refreshes_stores_and_accounts() {
#[test]
fn native_external_storage_on_restore_preserves_dirty_local_values() {
let ctx = Context::default();
let (mut app, _) = external_app(&ctx);
let (mut app, mock) = external_app(&ctx);
frame(&mut app, &ctx, true, false);
// The restore frame polls the manifest read right after starting it: the
// latency keeps that poll waiting, so begin_refresh runs after the edit.
mock.latency(30);
// Restoration must work even if the viewport still reports focus.
frame(&mut app, &ctx, true, true);
frame(&mut app, &ctx, true, false);
// Typed once the manifest read is under way. Typed before the frames
// above, a slow runner finished the write first, and the mock answers a
// write with no fingerprint: it read as an external change.
app.booted
.as_mut()
.unwrap()
.stores
.set_account_card_note("external", "local draft");
// Restoration must work even if the viewport still reports focus.
frame(&mut app, &ctx, true, true);
frame(&mut app, &ctx, true, false);
// begin_refresh records the other targets: the boundary, as below.
pump_until(&mut app, &ctx, |a| {
a.booted()
.unwrap()
.stores
.storage()
.manifest()
.stores
.get("app.config.local")
.is_some_and(|v| v == "config-2")
});
// A write still owed at the frame's end was owed when begin_refresh ran
// at its start: saves are polled later in the frame.
assert!(app
.booted()
.unwrap()
.stores
.storage()
.has_pending_save("client.account-card-notes"));
pump_until(&mut app, &ctx, |a| {
a.booted().unwrap().stores.view_mode() == ViewMode::List
});
Expand Down
Loading