()
| 1048 | |
| 1049 | #[test] |
| 1050 | fn test_store_default_by_usage() { |
| 1051 | let (_temp, mut store) = create_test_store(); |
| 1052 | |
| 1053 | let personal = Identity::builder("alice-personal") |
| 1054 | .usage(IdentityUsage::Personal) |
| 1055 | .build() |
| 1056 | .unwrap(); |
| 1057 | let work = Identity::builder("alice-work") |
| 1058 | .usage(IdentityUsage::Work) |
| 1059 | .build() |
| 1060 | .unwrap(); |
| 1061 | |
| 1062 | store.save(&personal).unwrap(); |
| 1063 | store.save(&work).unwrap(); |
| 1064 | |
| 1065 | store |
| 1066 | .set_default_for_usage(&IdentityUsage::Work, &work.id) |
| 1067 | .unwrap(); |
| 1068 | |
| 1069 | let work_default = store |
| 1070 | .get_default_for_usage(&IdentityUsage::Work) |
| 1071 | .unwrap() |
| 1072 | .unwrap(); |
| 1073 | assert_eq!(work_default.id, work.id); |
| 1074 | |
| 1075 | // Personal should fall back to None (no global default set) |
| 1076 | assert!(store |
| 1077 | .get_default_for_usage(&IdentityUsage::Personal) |
| 1078 | .unwrap() |
| 1079 | .is_none()); |
| 1080 | } |
| 1081 | |
| 1082 | #[test] |
| 1083 | fn test_store_exists() { |
nothing calls this directly
no test coverage detected