storage recent library checks added
@@ -102,6 +102,16 @@ fn actionctx_logout() {
}),
"profile updated successfully in storage"
);
+ assert!(
+ STORAGE
+ .read()
+ .unwrap()
+ .get(LIBRARY_RECENT_STORAGE_KEY)
+ .map_or(true, |data| {
+ serde_json::from_str::<(UID, Vec<LibItem>)>(&data).unwrap()
+ } == (None, vec![])),
+ "recent library updated successfully in storage"
+ );
assert!(
STORAGE
.read()
@@ -223,7 +233,7 @@ fn actionctx_login() {
.read()
.unwrap()
.get(PROFILE_STORAGE_KEY)
- .map_or(true, |data| {
+ .map_or(false, |data| {
serde_json::from_str::<Profile>(&data).unwrap()
} == Profile {
auth: Some(Auth {
@@ -242,12 +252,22 @@ fn actionctx_login() {
},),
"profile updated successfully in storage"
);
+ assert!(
+ STORAGE
+ .read()
+ .unwrap()
+ .get(LIBRARY_RECENT_STORAGE_KEY)
+ .map_or(false, |data| {
+ serde_json::from_str::<(UID, Vec<LibItem>)>(&data).unwrap()
+ } == (Some("user_id".to_owned()), vec![])),
+ "recent library updated successfully in storage"
+ );
assert!(
STORAGE
.read()
.unwrap()
.get(LIBRARY_STORAGE_KEY)
- .map_or(true, |data| {
+ .map_or(false, |data| {
serde_json::from_str::<(UID, Vec<LibItem>)>(&data).unwrap()
} == (Some("user_id".to_owned()), vec![])),
"library updated successfully in storage"
@@ -393,7 +413,7 @@ fn actionctx_signup() {
.read()
.unwrap()
.get(PROFILE_STORAGE_KEY)
- .map_or(true, |data| {
+ .map_or(false, |data| {
serde_json::from_str::<Profile>(&data).unwrap()
} == Profile {
auth: Some(Auth {
@@ -412,12 +432,22 @@ fn actionctx_signup() {
},),
"profile updated successfully in storage"
);
+ assert!(
+ STORAGE
+ .read()
+ .unwrap()
+ .get(LIBRARY_RECENT_STORAGE_KEY)
+ .map_or(false, |data| {
+ serde_json::from_str::<(UID, Vec<LibItem>)>(&data).unwrap()
+ } == (Some("user_id".to_owned()), vec![])),
+ "recent library updated successfully in storage"
+ );
assert!(
STORAGE
.read()
.unwrap()
.get(LIBRARY_STORAGE_KEY)
- .map_or(true, |data| {
+ .map_or(false, |data| {
serde_json::from_str::<(UID, Vec<LibItem>)>(&data).unwrap()
} == (Some("user_id".to_owned()), vec![])),
"library updated successfully in storage"
