upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/tests/git_remote_nostr/push.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-09-25 14:37:17 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-09-25 14:37:17 +0100
commitd6faad17e814d252a72e3aca39a4b3898382bab9 (patch)
tree16a238703293fe0d9cce04fa83de2af4a88f5433 /tests/git_remote_nostr/push.rs
parent4f84dc460c3494286233afe9ca480d3b7c0186b1 (diff)
chore: bump rust-nostr v0.35
bump all rust-nostr packages
Diffstat (limited to 'tests/git_remote_nostr/push.rs')
-rw-r--r--tests/git_remote_nostr/push.rs98
1 files changed, 49 insertions, 49 deletions
diff --git a/tests/git_remote_nostr/push.rs b/tests/git_remote_nostr/push.rs
index f552ee5..e0a4e93 100644
--- a/tests/git_remote_nostr/push.rs
+++ b/tests/git_remote_nostr/push.rs
@@ -298,7 +298,7 @@ mod two_branches_in_batch_one_added_one_updated {
298 let state_event = r56 298 let state_event = r56
299 .events 299 .events
300 .iter() 300 .iter()
301 .find(|e| e.kind().eq(&STATE_KIND)) 301 .find(|e| e.kind.eq(&STATE_KIND))
302 .context("state event not created")?; 302 .context("state event not created")?;
303 303
304 assert_eq!( 304 assert_eq!(
@@ -311,7 +311,7 @@ mod two_branches_in_batch_one_added_one_updated {
311 .tags 311 .tags
312 .iter() 312 .iter()
313 .filter(|t| t.kind().to_string().as_str().ne("d")) 313 .filter(|t| t.kind().to_string().as_str().ne("d"))
314 .map(|t| t.as_vec().to_vec()) 314 .map(|t| t.as_slice().to_vec())
315 .collect::<HashSet<Vec<String>>>(), 315 .collect::<HashSet<Vec<String>>>(),
316 HashSet::from([ 316 HashSet::from([
317 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()], 317 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()],
@@ -415,7 +415,7 @@ mod two_branches_in_batch_one_added_one_updated {
415 let state_event = r56 415 let state_event = r56
416 .events 416 .events
417 .iter() 417 .iter()
418 .find(|e| e.kind().eq(&STATE_KIND)) 418 .find(|e| e.kind.eq(&STATE_KIND))
419 .context("state event not created")?; 419 .context("state event not created")?;
420 420
421 // println!("{:#?}", state_event); 421 // println!("{:#?}", state_event);
@@ -424,7 +424,7 @@ mod two_branches_in_batch_one_added_one_updated {
424 .tags 424 .tags
425 .iter() 425 .iter()
426 .filter(|t| t.kind().to_string().as_str().ne("d")) 426 .filter(|t| t.kind().to_string().as_str().ne("d"))
427 .map(|t| t.as_vec().to_vec()) 427 .map(|t| t.as_slice().to_vec())
428 .collect::<HashSet<Vec<String>>>(), 428 .collect::<HashSet<Vec<String>>>(),
429 HashSet::from([ 429 HashSet::from([
430 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()], 430 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()],
@@ -710,7 +710,7 @@ mod delete_one_branch {
710 let state_event = r56 710 let state_event = r56
711 .events 711 .events
712 .iter() 712 .iter()
713 .find(|e| e.kind().eq(&STATE_KIND)) 713 .find(|e| e.kind.eq(&STATE_KIND))
714 .context("state event not created")?; 714 .context("state event not created")?;
715 715
716 // println!("{:#?}", state_event); 716 // println!("{:#?}", state_event);
@@ -719,7 +719,7 @@ mod delete_one_branch {
719 .tags 719 .tags
720 .iter() 720 .iter()
721 .filter(|t| t.kind().to_string().as_str().ne("d")) 721 .filter(|t| t.kind().to_string().as_str().ne("d"))
722 .map(|t| t.as_vec().to_vec()) 722 .map(|t| t.as_slice().to_vec())
723 .collect::<HashSet<Vec<String>>>(), 723 .collect::<HashSet<Vec<String>>>(),
724 HashSet::from([ 724 HashSet::from([
725 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()], 725 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()],
@@ -797,7 +797,7 @@ mod delete_one_branch {
797 let state_event = r56 797 let state_event = r56
798 .events 798 .events
799 .iter() 799 .iter()
800 .find(|e| e.kind().eq(&STATE_KIND)) 800 .find(|e| e.kind.eq(&STATE_KIND))
801 .context("state event not created")?; 801 .context("state event not created")?;
802 802
803 // println!("{:#?}", state_event); 803 // println!("{:#?}", state_event);
@@ -806,7 +806,7 @@ mod delete_one_branch {
806 .tags 806 .tags
807 .iter() 807 .iter()
808 .filter(|t| t.kind().to_string().as_str().ne("d")) 808 .filter(|t| t.kind().to_string().as_str().ne("d"))
809 .map(|t| t.as_vec().to_vec()) 809 .map(|t| t.as_slice().to_vec())
810 .collect::<HashSet<Vec<String>>>(), 810 .collect::<HashSet<Vec<String>>>(),
811 HashSet::from([ 811 HashSet::from([
812 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()], 812 vec!["HEAD".to_string(), "ref: refs/heads/main".to_string()],
@@ -980,16 +980,16 @@ async fn proposal_merge_commit_pushed_to_main_leads_to_status_event_issued() ->
980 .events 980 .events
981 .iter() 981 .iter()
982 .find(|e| { 982 .find(|e| {
983 e.tags() 983 e.tags
984 .iter() 984 .iter()
985 .find(|t| t.as_vec()[0].eq("branch-name")) 985 .find(|t| t.as_slice()[0].eq("branch-name"))
986 .is_some_and(|t| t.as_vec()[1].eq(FEATURE_BRANCH_NAME_1)) 986 .is_some_and(|t| t.as_slice()[1].eq(FEATURE_BRANCH_NAME_1))
987 }) 987 })
988 .unwrap(); 988 .unwrap();
989 989
990 let merge_status = new_events 990 let merge_status = new_events
991 .iter() 991 .iter()
992 .find(|e| e.kind().eq(&Kind::GitStatusApplied)) 992 .find(|e| e.kind.eq(&Kind::GitStatusApplied))
993 .unwrap(); 993 .unwrap();
994 994
995 assert_eq!( 995 assert_eq!(
@@ -997,9 +997,9 @@ async fn proposal_merge_commit_pushed_to_main_leads_to_status_event_issued() ->
997 merge_status 997 merge_status
998 .tags 998 .tags
999 .iter() 999 .iter()
1000 .find(|t| t.as_vec()[0].eq("merge-commit-id")) 1000 .find(|t| t.as_slice()[0].eq("merge-commit-id"))
1001 .unwrap() 1001 .unwrap()
1002 .as_vec()[1], 1002 .as_slice()[1],
1003 "status sets correct merge-commit-id tag" 1003 "status sets correct merge-commit-id tag"
1004 ); 1004 );
1005 1005
@@ -1007,35 +1007,35 @@ async fn proposal_merge_commit_pushed_to_main_leads_to_status_event_issued() ->
1007 .events 1007 .events
1008 .iter() 1008 .iter()
1009 .filter(|e| { 1009 .filter(|e| {
1010 e.tags() 1010 e.tags
1011 .iter() 1011 .iter()
1012 .any(|t| t.as_vec()[1].eq(&proposal.id().to_string())) 1012 .any(|t| t.as_slice()[1].eq(&proposal.id.to_string()))
1013 && e.kind().eq(&Kind::GitPatch) 1013 && e.kind.eq(&Kind::GitPatch)
1014 }) 1014 })
1015 .last() 1015 .last()
1016 .unwrap(); 1016 .unwrap();
1017 1017
1018 assert_eq!( 1018 assert_eq!(
1019 proposal_tip.id().to_string(), 1019 proposal_tip.id.to_string(),
1020 merge_status 1020 merge_status
1021 .tags 1021 .tags
1022 .iter() 1022 .iter()
1023 .find(|t| t.as_vec().len().eq(&4) && t.as_vec()[3].eq("mention")) 1023 .find(|t| t.as_slice().len().eq(&4) && t.as_slice()[3].eq("mention"))
1024 .unwrap() 1024 .unwrap()
1025 .as_vec()[1], 1025 .as_slice()[1],
1026 "status mentions proposal tip event \r\nmerge status:\r\n{}\r\nproposal tip:\r\n{}", 1026 "status mentions proposal tip event \r\nmerge status:\r\n{}\r\nproposal tip:\r\n{}",
1027 merge_status.as_json(), 1027 merge_status.as_json(),
1028 proposal_tip.as_json(), 1028 proposal_tip.as_json(),
1029 ); 1029 );
1030 1030
1031 assert_eq!( 1031 assert_eq!(
1032 proposal.id().to_string(), 1032 proposal.id.to_string(),
1033 merge_status 1033 merge_status
1034 .tags 1034 .tags
1035 .iter() 1035 .iter()
1036 .find(|t| t.is_root()) 1036 .find(|t| t.is_root())
1037 .unwrap() 1037 .unwrap()
1038 .as_vec()[1], 1038 .as_slice()[1],
1039 "status tags proposal id as root \r\nmerge status:\r\n{}\r\nproposal:\r\n{}", 1039 "status tags proposal id as root \r\nmerge status:\r\n{}\r\nproposal:\r\n{}",
1040 merge_status.as_json(), 1040 merge_status.as_json(),
1041 proposal.as_json(), 1041 proposal.as_json(),
@@ -1136,32 +1136,32 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> {
1136 .events 1136 .events
1137 .iter() 1137 .iter()
1138 .find(|e| { 1138 .find(|e| {
1139 e.tags() 1139 e.tags
1140 .iter() 1140 .iter()
1141 .find(|t| t.as_vec()[0].eq("branch-name")) 1141 .find(|t| t.as_slice()[0].eq("branch-name"))
1142 .is_some_and(|t| t.as_vec()[1].eq(FEATURE_BRANCH_NAME_1)) 1142 .is_some_and(|t| t.as_slice()[1].eq(FEATURE_BRANCH_NAME_1))
1143 }) 1143 })
1144 .unwrap(); 1144 .unwrap();
1145 1145
1146 assert_eq!( 1146 assert_eq!(
1147 proposal.id().to_string(), 1147 proposal.id.to_string(),
1148 first_new_patch 1148 first_new_patch
1149 .tags 1149 .tags
1150 .iter() 1150 .iter()
1151 .find(|t| t.is_root()) 1151 .find(|t| t.is_root())
1152 .unwrap() 1152 .unwrap()
1153 .as_vec()[1], 1153 .as_slice()[1],
1154 "first patch sets proposal id as root" 1154 "first patch sets proposal id as root"
1155 ); 1155 );
1156 1156
1157 assert_eq!( 1157 assert_eq!(
1158 first_new_patch.id().to_string(), 1158 first_new_patch.id.to_string(),
1159 second_new_patch 1159 second_new_patch
1160 .tags 1160 .tags
1161 .iter() 1161 .iter()
1162 .find(|t| t.is_reply()) 1162 .find(|t| t.is_reply())
1163 .unwrap() 1163 .unwrap()
1164 .as_vec()[1], 1164 .as_slice()[1],
1165 "second new patch replies to the first new patch" 1165 "second new patch replies to the first new patch"
1166 ); 1166 );
1167 1167
@@ -1169,21 +1169,21 @@ async fn push_2_commits_to_existing_proposal() -> Result<()> {
1169 .events 1169 .events
1170 .iter() 1170 .iter()
1171 .find(|e| { 1171 .find(|e| {
1172 e.tags() 1172 e.tags
1173 .iter() 1173 .iter()
1174 .any(|t| t.as_vec()[1].eq(&proposal.id().to_string())) 1174 .any(|t| t.as_slice()[1].eq(&proposal.id.to_string()))
1175 && e.content.contains("[PATCH 2/2]") 1175 && e.content.contains("[PATCH 2/2]")
1176 }) 1176 })
1177 .unwrap(); 1177 .unwrap();
1178 1178
1179 assert_eq!( 1179 assert_eq!(
1180 previous_proposal_tip_event.id().to_string(), 1180 previous_proposal_tip_event.id.to_string(),
1181 first_new_patch 1181 first_new_patch
1182 .tags 1182 .tags
1183 .iter() 1183 .iter()
1184 .find(|t| t.is_reply()) 1184 .find(|t| t.is_reply())
1185 .unwrap() 1185 .unwrap()
1186 .as_vec()[1], 1186 .as_slice()[1],
1187 "first patch replies to the previous tip of proposal" 1187 "first patch replies to the previous tip of proposal"
1188 ); 1188 );
1189 1189
@@ -1275,26 +1275,26 @@ async fn force_push_creates_proposal_revision() -> Result<()> {
1275 .events 1275 .events
1276 .iter() 1276 .iter()
1277 .find(|e| { 1277 .find(|e| {
1278 e.tags() 1278 e.tags
1279 .iter() 1279 .iter()
1280 .find(|t| t.as_vec()[0].eq("branch-name")) 1280 .find(|t| t.as_slice()[0].eq("branch-name"))
1281 .is_some_and(|t| t.as_vec()[1].eq(FEATURE_BRANCH_NAME_1)) 1281 .is_some_and(|t| t.as_slice()[1].eq(FEATURE_BRANCH_NAME_1))
1282 }) 1282 })
1283 .unwrap(); 1283 .unwrap();
1284 1284
1285 let revision_root_patch = new_events 1285 let revision_root_patch = new_events
1286 .iter() 1286 .iter()
1287 .find(|e| e.tags().iter().any(|t| t.as_vec()[1].eq("revision-root"))) 1287 .find(|e| e.tags.iter().any(|t| t.as_slice()[1].eq("revision-root")))
1288 .unwrap(); 1288 .unwrap();
1289 1289
1290 assert_eq!( 1290 assert_eq!(
1291 proposal.id().to_string(), 1291 proposal.id.to_string(),
1292 revision_root_patch 1292 revision_root_patch
1293 .tags 1293 .tags
1294 .iter() 1294 .iter()
1295 .find(|t| t.is_reply()) 1295 .find(|t| t.is_reply())
1296 .unwrap() 1296 .unwrap()
1297 .as_vec()[1], 1297 .as_slice()[1],
1298 "revision root patch replies to original proposal" 1298 "revision root patch replies to original proposal"
1299 ); 1299 );
1300 1300
@@ -1321,24 +1321,24 @@ async fn force_push_creates_proposal_revision() -> Result<()> {
1321 ); 1321 );
1322 1322
1323 assert_eq!( 1323 assert_eq!(
1324 revision_root_patch.id().to_string(), 1324 revision_root_patch.id.to_string(),
1325 second_patch 1325 second_patch
1326 .tags 1326 .tags
1327 .iter() 1327 .iter()
1328 .find(|t| t.is_root()) 1328 .find(|t| t.is_root())
1329 .unwrap() 1329 .unwrap()
1330 .as_vec()[1], 1330 .as_slice()[1],
1331 "second patch sets revision id as root" 1331 "second patch sets revision id as root"
1332 ); 1332 );
1333 1333
1334 assert_eq!( 1334 assert_eq!(
1335 second_patch.id().to_string(), 1335 second_patch.id.to_string(),
1336 third_patch 1336 third_patch
1337 .tags 1337 .tags
1338 .iter() 1338 .iter()
1339 .find(|t| t.is_reply()) 1339 .find(|t| t.is_reply())
1340 .unwrap() 1340 .unwrap()
1341 .as_vec()[1], 1341 .as_slice()[1],
1342 "third patch replies to the second new patch" 1342 "third patch replies to the second new patch"
1343 ); 1343 );
1344 1344
@@ -1423,7 +1423,7 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> {
1423 1423
1424 let proposal = new_events 1424 let proposal = new_events
1425 .iter() 1425 .iter()
1426 .find(|e| e.tags().iter().any(|t| t.as_vec()[1].eq("root"))) 1426 .find(|e| e.tags.iter().any(|t| t.as_slice()[1].eq("root")))
1427 .unwrap(); 1427 .unwrap();
1428 1428
1429 assert!( 1429 assert!(
@@ -1438,11 +1438,11 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> {
1438 1438
1439 assert_eq!( 1439 assert_eq!(
1440 proposal 1440 proposal
1441 .tags() 1441 .tags
1442 .iter() 1442 .iter()
1443 .find(|t| t.as_vec()[0].eq("branch-name")) 1443 .find(|t| t.as_slice()[0].eq("branch-name"))
1444 .unwrap() 1444 .unwrap()
1445 .as_vec()[1], 1445 .as_slice()[1],
1446 branch_name.replace("pr/", ""), 1446 branch_name.replace("pr/", ""),
1447 ); 1447 );
1448 1448
@@ -1457,13 +1457,13 @@ async fn push_new_pr_branch_creates_proposal() -> Result<()> {
1457 ); 1457 );
1458 1458
1459 assert_eq!( 1459 assert_eq!(
1460 proposal.id().to_string(), 1460 proposal.id.to_string(),
1461 second_patch 1461 second_patch
1462 .tags 1462 .tags
1463 .iter() 1463 .iter()
1464 .find(|t| t.is_root()) 1464 .find(|t| t.is_root())
1465 .unwrap() 1465 .unwrap()
1466 .as_vec()[1], 1466 .as_slice()[1],
1467 "second patch sets proposal id as root" 1467 "second patch sets proposal id as root"
1468 ); 1468 );
1469 1469