MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_store_default_by_usage

Function test_store_default_by_usage

atomic-identity/src/store.rs:1257–1287  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1255
1256 #[test]
1257 fn test_store_default_by_usage() {
1258 let (_temp, mut store) = create_test_store();
1259
1260 let personal = Identity::builder("alice-personal")
1261 .usage(IdentityUsage::Personal)
1262 .build()
1263 .unwrap();
1264 let work = Identity::builder("alice-work")
1265 .usage(IdentityUsage::Work)
1266 .build()
1267 .unwrap();
1268
1269 store.save(&personal).unwrap();
1270 store.save(&work).unwrap();
1271
1272 store
1273 .set_default_for_usage(&IdentityUsage::Work, &work.id)
1274 .unwrap();
1275
1276 let work_default = store
1277 .get_default_for_usage(&IdentityUsage::Work)
1278 .unwrap()
1279 .unwrap();
1280 assert_eq!(work_default.id, work.id);
1281
1282 // Personal should fall back to None (no global default set)
1283 assert!(store
1284 .get_default_for_usage(&IdentityUsage::Personal)
1285 .unwrap()
1286 .is_none());
1287 }
1288
1289 #[test]
1290 fn test_store_exists() {

Callers

nothing calls this directly

Calls 7

set_default_for_usageMethod · 0.80
get_default_for_usageMethod · 0.80
create_test_storeFunction · 0.70
unwrapMethod · 0.45
buildMethod · 0.45
usageMethod · 0.45
saveMethod · 0.45

Tested by

no test coverage detected