Skip to content
Open
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
12 changes: 11 additions & 1 deletion components/fxa-client/src/internal/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,23 @@ mod tests {
avatar: "https://foo.avatar".to_string(),
avatar_default: true,
},
etag: None,
etag: Some("123".to_string()),
}))
});
fxa.set_client(Arc::new(client));

let p = fxa.get_profile(false).unwrap();
assert_eq!(p.email, "foo@bar.com");
// do it again to check our caching - if it wasn't cached and we hit our mock
// of fetching the profile we'd still fail due to the mock only expecting 1 call.
let p = fxa.get_profile(false).unwrap();
assert_eq!(p.email, "foo@bar.com");

// make sure the cached value doesn't survive a disconnect.
fxa.disconnect();
// now we should have no cached value, but wont even try to hit the server as we
// have no session token.
assert!(matches!(fxa.get_profile(false), Err(Error::NoSessionToken)));
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions components/fxa-client/src/internal/state_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ impl StateManager {
self.persisted_state.server_local_device_info = None;
self.persisted_state.session_token = None;
self.persisted_state.logged_out_from_auth_issues = false;
self.persisted_state.last_seen_profile = None;
self.flow_store.clear();
}

Expand Down