diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-16 22:31:29 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-16 22:31:29 +0000 |
| commit | 701668b02d999af42f51d8bd25fffb2a8692c3c8 (patch) | |
| tree | 7defd0e7e711d743c8464994c2223a7a332ccf2a /tests | |
| parent | 61ffbf2008c0aaaee3d19ac027d63bca823dc8c9 (diff) | |
refactor: rename PR to proposal
PR is a problematic term when it ambiguous whether the
set of patches are PR-like or email-patch like.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/list.rs | 236 | ||||
| -rw-r--r-- | tests/pull.rs | 56 | ||||
| -rw-r--r-- | tests/push.rs | 62 | ||||
| -rw-r--r-- | tests/send.rs | 95 |
4 files changed, 226 insertions, 223 deletions
diff --git a/tests/list.rs b/tests/list.rs index 4337d73..e072ff5 100644 --- a/tests/list.rs +++ b/tests/list.rs | |||
| @@ -8,30 +8,30 @@ static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; | |||
| 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; | 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; |
| 9 | static FEATURE_BRANCH_NAME_4: &str = "feature-example-d"; | 9 | static FEATURE_BRANCH_NAME_4: &str = "feature-example-d"; |
| 10 | 10 | ||
| 11 | static PR_TITLE_1: &str = "pr a"; | 11 | static PROPOSAL_TITLE_1: &str = "proposal a"; |
| 12 | static PR_TITLE_2: &str = "pr b"; | 12 | static PROPOSAL_TITLE_2: &str = "proposal b"; |
| 13 | static PR_TITLE_3: &str = "pr c"; | 13 | static PROPOSAL_TITLE_3: &str = "proposal c"; |
| 14 | 14 | ||
| 15 | fn cli_tester_create_prs() -> Result<GitTestRepo> { | 15 | fn cli_tester_create_proposals() -> Result<GitTestRepo> { |
| 16 | let git_repo = GitTestRepo::default(); | 16 | let git_repo = GitTestRepo::default(); |
| 17 | git_repo.populate()?; | 17 | git_repo.populate()?; |
| 18 | cli_tester_create_pr( | 18 | cli_tester_create_proposal( |
| 19 | &git_repo, | 19 | &git_repo, |
| 20 | FEATURE_BRANCH_NAME_1, | 20 | FEATURE_BRANCH_NAME_1, |
| 21 | "a", | 21 | "a", |
| 22 | Some((PR_TITLE_1, "pr a description")), | 22 | Some((PROPOSAL_TITLE_1, "proposal a description")), |
| 23 | )?; | 23 | )?; |
| 24 | cli_tester_create_pr( | 24 | cli_tester_create_proposal( |
| 25 | &git_repo, | 25 | &git_repo, |
| 26 | FEATURE_BRANCH_NAME_2, | 26 | FEATURE_BRANCH_NAME_2, |
| 27 | "b", | 27 | "b", |
| 28 | Some((PR_TITLE_2, "pr b description")), | 28 | Some((PROPOSAL_TITLE_2, "proposal b description")), |
| 29 | )?; | 29 | )?; |
| 30 | cli_tester_create_pr( | 30 | cli_tester_create_proposal( |
| 31 | &git_repo, | 31 | &git_repo, |
| 32 | FEATURE_BRANCH_NAME_3, | 32 | FEATURE_BRANCH_NAME_3, |
| 33 | "c", | 33 | "c", |
| 34 | Some((PR_TITLE_3, "pr c description")), | 34 | Some((PROPOSAL_TITLE_3, "proposal c description")), |
| 35 | )?; | 35 | )?; |
| 36 | Ok(git_repo) | 36 | Ok(git_repo) |
| 37 | } | 37 | } |
| @@ -60,7 +60,7 @@ fn create_and_populate_branch( | |||
| 60 | Ok(()) | 60 | Ok(()) |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | fn cli_tester_create_pr( | 63 | fn cli_tester_create_proposal( |
| 64 | test_repo: &GitTestRepo, | 64 | test_repo: &GitTestRepo, |
| 65 | branch_name: &str, | 65 | branch_name: &str, |
| 66 | prefix: &str, | 66 | prefix: &str, |
| @@ -158,8 +158,8 @@ mod cannot_find_repo_event { | |||
| 158 | } | 158 | } |
| 159 | .to_bech32()?, | 159 | .to_bech32()?, |
| 160 | )?; | 160 | )?; |
| 161 | p.expect("finding PRs...\r\n")?; | 161 | p.expect("finding proposals...\r\n")?; |
| 162 | p.expect_end_with("no PRs found... create one? try `ngit send`\r\n")?; | 162 | p.expect_end_with("no proposals found... create one? try `ngit send`\r\n")?; |
| 163 | } | 163 | } |
| 164 | if naddr { | 164 | if naddr { |
| 165 | let mut input = p.expect_input("repository naddr or nevent")?; | 165 | let mut input = p.expect_input("repository naddr or nevent")?; |
| @@ -172,8 +172,8 @@ mod cannot_find_repo_event { | |||
| 172 | } | 172 | } |
| 173 | .to_bech32()?, | 173 | .to_bech32()?, |
| 174 | )?; | 174 | )?; |
| 175 | p.expect("finding PRs...\r\n")?; | 175 | p.expect("finding proposals...\r\n")?; |
| 176 | p.expect_end_with("no PRs found... create one? try `ngit send`\r\n")?; | 176 | p.expect_end_with("no proposals found... create one? try `ngit send`\r\n")?; |
| 177 | p.expect_end_eventually()?; | 177 | p.expect_end_eventually()?; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| @@ -220,17 +220,17 @@ mod cannot_find_repo_event { | |||
| 220 | mod when_main_branch_is_uptodate { | 220 | mod when_main_branch_is_uptodate { |
| 221 | use super::*; | 221 | use super::*; |
| 222 | 222 | ||
| 223 | mod when_pr_branch_doesnt_exist { | 223 | mod when_proposal_branch_doesnt_exist { |
| 224 | use super::*; | 224 | use super::*; |
| 225 | 225 | ||
| 226 | mod when_main_is_checked_out { | 226 | mod when_main_is_checked_out { |
| 227 | use super::*; | 227 | use super::*; |
| 228 | 228 | ||
| 229 | mod when_first_pr_selected { | 229 | mod when_first_proposal_selected { |
| 230 | use super::*; | 230 | use super::*; |
| 231 | 231 | ||
| 232 | // TODO: test when other prs with the same name but from other repositories are | 232 | // TODO: test when other proposals with the same name but from other |
| 233 | // present on relays | 233 | // repositories are present on relays |
| 234 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { | 234 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { |
| 235 | // fallback (51,52) user write (53, 55) repo (55, 56) | 235 | // fallback (51,52) user write (53, 55) repo (55, 56) |
| 236 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 236 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| @@ -251,19 +251,19 @@ mod when_main_branch_is_uptodate { | |||
| 251 | 251 | ||
| 252 | let cli_tester_handle = | 252 | let cli_tester_handle = |
| 253 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 253 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 254 | let originating_repo = cli_tester_create_prs()?; | 254 | let originating_repo = cli_tester_create_proposals()?; |
| 255 | 255 | ||
| 256 | let test_repo = GitTestRepo::default(); | 256 | let test_repo = GitTestRepo::default(); |
| 257 | test_repo.populate()?; | 257 | test_repo.populate()?; |
| 258 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 258 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 259 | 259 | ||
| 260 | p.expect("finding PRs...\r\n")?; | 260 | p.expect("finding proposals...\r\n")?; |
| 261 | let mut c = p.expect_choice( | 261 | let mut c = p.expect_choice( |
| 262 | "All PRs", | 262 | "all proposals", |
| 263 | vec![ | 263 | vec![ |
| 264 | format!("\"{PR_TITLE_1}\""), | 264 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 265 | format!("\"{PR_TITLE_2}\""), | 265 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 266 | format!("\"{PR_TITLE_3}\""), | 266 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 267 | ], | 267 | ], |
| 268 | )?; | 268 | )?; |
| 269 | c.succeeds_with(0, true)?; | 269 | c.succeeds_with(0, true)?; |
| @@ -293,7 +293,7 @@ mod when_main_branch_is_uptodate { | |||
| 293 | 293 | ||
| 294 | mod cli_prompts { | 294 | mod cli_prompts { |
| 295 | use super::*; | 295 | use super::*; |
| 296 | async fn run_async_prompts_to_choose_from_pr_titles() -> Result<()> { | 296 | async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 297 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 297 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| 298 | Relay::new(8051, None, None), | 298 | Relay::new(8051, None, None), |
| 299 | Relay::new(8052, None, None), | 299 | Relay::new(8052, None, None), |
| @@ -311,26 +311,26 @@ mod when_main_branch_is_uptodate { | |||
| 311 | r55.events.push(generate_test_key_1_relay_list_event()); | 311 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 312 | 312 | ||
| 313 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 313 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 314 | cli_tester_create_prs()?; | 314 | cli_tester_create_proposals()?; |
| 315 | 315 | ||
| 316 | let test_repo = GitTestRepo::default(); | 316 | let test_repo = GitTestRepo::default(); |
| 317 | test_repo.populate()?; | 317 | test_repo.populate()?; |
| 318 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 318 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 319 | 319 | ||
| 320 | p.expect("finding PRs...\r\n")?; | 320 | p.expect("finding proposals...\r\n")?; |
| 321 | let mut c = p.expect_choice( | 321 | let mut c = p.expect_choice( |
| 322 | "All PRs", | 322 | "all proposals", |
| 323 | vec![ | 323 | vec![ |
| 324 | format!("\"{PR_TITLE_1}\""), | 324 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 325 | format!("\"{PR_TITLE_2}\""), | 325 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 326 | format!("\"{PR_TITLE_3}\""), | 326 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 327 | ], | 327 | ], |
| 328 | )?; | 328 | )?; |
| 329 | c.succeeds_with(0, true)?; | 329 | c.succeeds_with(0, true)?; |
| 330 | p.expect("finding commits...\r\n")?; | 330 | p.expect("finding commits...\r\n")?; |
| 331 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 331 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; |
| 332 | confirm.succeeds_with(None)?; | 332 | confirm.succeeds_with(None)?; |
| 333 | p.expect("checked out PR branch. pulled 2 new commits\r\n")?; | 333 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; |
| 334 | p.expect_end()?; | 334 | p.expect_end()?; |
| 335 | 335 | ||
| 336 | for p in [51, 52, 53, 55, 56] { | 336 | for p in [51, 52, 53, 55, 56] { |
| @@ -354,15 +354,15 @@ mod when_main_branch_is_uptodate { | |||
| 354 | 354 | ||
| 355 | #[tokio::test] | 355 | #[tokio::test] |
| 356 | #[serial] | 356 | #[serial] |
| 357 | async fn prompts_to_choose_from_pr_titles() -> Result<()> { | 357 | async fn prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 358 | let _ = run_async_prompts_to_choose_from_pr_titles().await; | 358 | let _ = run_async_prompts_to_choose_from_proposal_titles().await; |
| 359 | Ok(()) | 359 | Ok(()) |
| 360 | } | 360 | } |
| 361 | } | 361 | } |
| 362 | 362 | ||
| 363 | #[tokio::test] | 363 | #[tokio::test] |
| 364 | #[serial] | 364 | #[serial] |
| 365 | async fn pr_branch_created_with_correct_name() -> Result<()> { | 365 | async fn proposal_branch_created_with_correct_name() -> Result<()> { |
| 366 | let (_, test_repo) = prep_and_run().await?; | 366 | let (_, test_repo) = prep_and_run().await?; |
| 367 | assert_eq!( | 367 | assert_eq!( |
| 368 | vec![FEATURE_BRANCH_NAME_1, "main"], | 368 | vec![FEATURE_BRANCH_NAME_1, "main"], |
| @@ -373,7 +373,7 @@ mod when_main_branch_is_uptodate { | |||
| 373 | 373 | ||
| 374 | #[tokio::test] | 374 | #[tokio::test] |
| 375 | #[serial] | 375 | #[serial] |
| 376 | async fn pr_branch_checked_out() -> Result<()> { | 376 | async fn proposal_branch_checked_out() -> Result<()> { |
| 377 | let (_, test_repo) = prep_and_run().await?; | 377 | let (_, test_repo) = prep_and_run().await?; |
| 378 | assert_eq!( | 378 | assert_eq!( |
| 379 | FEATURE_BRANCH_NAME_1, | 379 | FEATURE_BRANCH_NAME_1, |
| @@ -384,7 +384,7 @@ mod when_main_branch_is_uptodate { | |||
| 384 | 384 | ||
| 385 | #[tokio::test] | 385 | #[tokio::test] |
| 386 | #[serial] | 386 | #[serial] |
| 387 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 387 | async fn proposal_branch_tip_is_most_recent_patch() -> Result<()> { |
| 388 | let (originating_repo, test_repo) = prep_and_run().await?; | 388 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 389 | assert_eq!( | 389 | assert_eq!( |
| 390 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, | 390 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, |
| @@ -393,7 +393,7 @@ mod when_main_branch_is_uptodate { | |||
| 393 | Ok(()) | 393 | Ok(()) |
| 394 | } | 394 | } |
| 395 | } | 395 | } |
| 396 | mod when_third_pr_selected { | 396 | mod when_third_proposal_selected { |
| 397 | use super::*; | 397 | use super::*; |
| 398 | 398 | ||
| 399 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { | 399 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { |
| @@ -416,19 +416,19 @@ mod when_main_branch_is_uptodate { | |||
| 416 | 416 | ||
| 417 | let cli_tester_handle = | 417 | let cli_tester_handle = |
| 418 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 418 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 419 | let originating_repo = cli_tester_create_prs()?; | 419 | let originating_repo = cli_tester_create_proposals()?; |
| 420 | 420 | ||
| 421 | let test_repo = GitTestRepo::default(); | 421 | let test_repo = GitTestRepo::default(); |
| 422 | test_repo.populate()?; | 422 | test_repo.populate()?; |
| 423 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 423 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 424 | 424 | ||
| 425 | p.expect("finding PRs...\r\n")?; | 425 | p.expect("finding proposals...\r\n")?; |
| 426 | let mut c = p.expect_choice( | 426 | let mut c = p.expect_choice( |
| 427 | "All PRs", | 427 | "all proposals", |
| 428 | vec![ | 428 | vec![ |
| 429 | format!("\"{PR_TITLE_1}\""), | 429 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 430 | format!("\"{PR_TITLE_2}\""), | 430 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 431 | format!("\"{PR_TITLE_3}\""), | 431 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 432 | ], | 432 | ], |
| 433 | )?; | 433 | )?; |
| 434 | c.succeeds_with(2, true)?; | 434 | c.succeeds_with(2, true)?; |
| @@ -458,7 +458,7 @@ mod when_main_branch_is_uptodate { | |||
| 458 | 458 | ||
| 459 | mod cli_prompts { | 459 | mod cli_prompts { |
| 460 | use super::*; | 460 | use super::*; |
| 461 | async fn run_async_prompts_to_choose_from_pr_titles() -> Result<()> { | 461 | async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 462 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 462 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| 463 | Relay::new(8051, None, None), | 463 | Relay::new(8051, None, None), |
| 464 | Relay::new(8052, None, None), | 464 | Relay::new(8052, None, None), |
| @@ -476,26 +476,26 @@ mod when_main_branch_is_uptodate { | |||
| 476 | r55.events.push(generate_test_key_1_relay_list_event()); | 476 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 477 | 477 | ||
| 478 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 478 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 479 | cli_tester_create_prs()?; | 479 | cli_tester_create_proposals()?; |
| 480 | 480 | ||
| 481 | let test_repo = GitTestRepo::default(); | 481 | let test_repo = GitTestRepo::default(); |
| 482 | test_repo.populate()?; | 482 | test_repo.populate()?; |
| 483 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 483 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 484 | 484 | ||
| 485 | p.expect("finding PRs...\r\n")?; | 485 | p.expect("finding proposals...\r\n")?; |
| 486 | let mut c = p.expect_choice( | 486 | let mut c = p.expect_choice( |
| 487 | "All PRs", | 487 | "all proposals", |
| 488 | vec![ | 488 | vec![ |
| 489 | format!("\"{PR_TITLE_1}\""), | 489 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 490 | format!("\"{PR_TITLE_2}\""), | 490 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 491 | format!("\"{PR_TITLE_3}\""), | 491 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 492 | ], | 492 | ], |
| 493 | )?; | 493 | )?; |
| 494 | c.succeeds_with(2, true)?; | 494 | c.succeeds_with(2, true)?; |
| 495 | p.expect("finding commits...\r\n")?; | 495 | p.expect("finding commits...\r\n")?; |
| 496 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 496 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; |
| 497 | confirm.succeeds_with(None)?; | 497 | confirm.succeeds_with(None)?; |
| 498 | p.expect("checked out PR branch. pulled 2 new commits\r\n")?; | 498 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; |
| 499 | p.expect_end()?; | 499 | p.expect_end()?; |
| 500 | 500 | ||
| 501 | for p in [51, 52, 53, 55, 56] { | 501 | for p in [51, 52, 53, 55, 56] { |
| @@ -519,15 +519,15 @@ mod when_main_branch_is_uptodate { | |||
| 519 | 519 | ||
| 520 | #[tokio::test] | 520 | #[tokio::test] |
| 521 | #[serial] | 521 | #[serial] |
| 522 | async fn prompts_to_choose_from_pr_titles() -> Result<()> { | 522 | async fn prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 523 | let _ = run_async_prompts_to_choose_from_pr_titles().await; | 523 | let _ = run_async_prompts_to_choose_from_proposal_titles().await; |
| 524 | Ok(()) | 524 | Ok(()) |
| 525 | } | 525 | } |
| 526 | } | 526 | } |
| 527 | 527 | ||
| 528 | #[tokio::test] | 528 | #[tokio::test] |
| 529 | #[serial] | 529 | #[serial] |
| 530 | async fn pr_branch_created_with_correct_name() -> Result<()> { | 530 | async fn proposal_branch_created_with_correct_name() -> Result<()> { |
| 531 | let (_, test_repo) = prep_and_run().await?; | 531 | let (_, test_repo) = prep_and_run().await?; |
| 532 | assert_eq!( | 532 | assert_eq!( |
| 533 | vec![FEATURE_BRANCH_NAME_3, "main"], | 533 | vec![FEATURE_BRANCH_NAME_3, "main"], |
| @@ -538,7 +538,7 @@ mod when_main_branch_is_uptodate { | |||
| 538 | 538 | ||
| 539 | #[tokio::test] | 539 | #[tokio::test] |
| 540 | #[serial] | 540 | #[serial] |
| 541 | async fn pr_branch_checked_out() -> Result<()> { | 541 | async fn proposal_branch_checked_out() -> Result<()> { |
| 542 | let (_, test_repo) = prep_and_run().await?; | 542 | let (_, test_repo) = prep_and_run().await?; |
| 543 | assert_eq!( | 543 | assert_eq!( |
| 544 | FEATURE_BRANCH_NAME_3, | 544 | FEATURE_BRANCH_NAME_3, |
| @@ -549,7 +549,7 @@ mod when_main_branch_is_uptodate { | |||
| 549 | 549 | ||
| 550 | #[tokio::test] | 550 | #[tokio::test] |
| 551 | #[serial] | 551 | #[serial] |
| 552 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 552 | async fn proposal_branch_tip_is_most_recent_patch() -> Result<()> { |
| 553 | let (originating_repo, test_repo) = prep_and_run().await?; | 553 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 554 | assert_eq!( | 554 | assert_eq!( |
| 555 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?, | 555 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_3)?, |
| @@ -558,7 +558,7 @@ mod when_main_branch_is_uptodate { | |||
| 558 | Ok(()) | 558 | Ok(()) |
| 559 | } | 559 | } |
| 560 | } | 560 | } |
| 561 | mod when_forth_pr_has_no_cover_letter { | 561 | mod when_forth_proposal_has_no_cover_letter { |
| 562 | use super::*; | 562 | use super::*; |
| 563 | 563 | ||
| 564 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { | 564 | async fn prep_and_run() -> Result<(GitTestRepo, GitTestRepo)> { |
| @@ -581,8 +581,8 @@ mod when_main_branch_is_uptodate { | |||
| 581 | 581 | ||
| 582 | let cli_tester_handle = | 582 | let cli_tester_handle = |
| 583 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 583 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 584 | let originating_repo = cli_tester_create_prs()?; | 584 | let originating_repo = cli_tester_create_proposals()?; |
| 585 | cli_tester_create_pr( | 585 | cli_tester_create_proposal( |
| 586 | &originating_repo, | 586 | &originating_repo, |
| 587 | FEATURE_BRANCH_NAME_4, | 587 | FEATURE_BRANCH_NAME_4, |
| 588 | "d", | 588 | "d", |
| @@ -592,13 +592,13 @@ mod when_main_branch_is_uptodate { | |||
| 592 | test_repo.populate()?; | 592 | test_repo.populate()?; |
| 593 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 593 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 594 | 594 | ||
| 595 | p.expect("finding PRs...\r\n")?; | 595 | p.expect("finding proposals...\r\n")?; |
| 596 | let mut c = p.expect_choice( | 596 | let mut c = p.expect_choice( |
| 597 | "All PRs", | 597 | "all proposals", |
| 598 | vec![ | 598 | vec![ |
| 599 | format!("\"{PR_TITLE_1}\""), | 599 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 600 | format!("\"{PR_TITLE_2}\""), | 600 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 601 | format!("\"{PR_TITLE_3}\""), | 601 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 602 | format!("add d3.md"), // commit msg title | 602 | format!("add d3.md"), // commit msg title |
| 603 | ], | 603 | ], |
| 604 | )?; | 604 | )?; |
| @@ -629,7 +629,7 @@ mod when_main_branch_is_uptodate { | |||
| 629 | 629 | ||
| 630 | mod cli_prompts { | 630 | mod cli_prompts { |
| 631 | use super::*; | 631 | use super::*; |
| 632 | async fn run_async_prompts_to_choose_from_pr_titles() -> Result<()> { | 632 | async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 633 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 633 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| 634 | Relay::new(8051, None, None), | 634 | Relay::new(8051, None, None), |
| 635 | Relay::new(8052, None, None), | 635 | Relay::new(8052, None, None), |
| @@ -647,8 +647,8 @@ mod when_main_branch_is_uptodate { | |||
| 647 | r55.events.push(generate_test_key_1_relay_list_event()); | 647 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 648 | 648 | ||
| 649 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 649 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 650 | let originating_repo = cli_tester_create_prs()?; | 650 | let originating_repo = cli_tester_create_proposals()?; |
| 651 | cli_tester_create_pr( | 651 | cli_tester_create_proposal( |
| 652 | &originating_repo, | 652 | &originating_repo, |
| 653 | FEATURE_BRANCH_NAME_4, | 653 | FEATURE_BRANCH_NAME_4, |
| 654 | "d", | 654 | "d", |
| @@ -658,13 +658,13 @@ mod when_main_branch_is_uptodate { | |||
| 658 | test_repo.populate()?; | 658 | test_repo.populate()?; |
| 659 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); | 659 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["list"]); |
| 660 | 660 | ||
| 661 | p.expect("finding PRs...\r\n")?; | 661 | p.expect("finding proposals...\r\n")?; |
| 662 | let mut c = p.expect_choice( | 662 | let mut c = p.expect_choice( |
| 663 | "All PRs", | 663 | "all proposals", |
| 664 | vec![ | 664 | vec![ |
| 665 | format!("\"{PR_TITLE_1}\""), | 665 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 666 | format!("\"{PR_TITLE_2}\""), | 666 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 667 | format!("\"{PR_TITLE_3}\""), | 667 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 668 | format!("add d3.md"), // commit msg title | 668 | format!("add d3.md"), // commit msg title |
| 669 | ], | 669 | ], |
| 670 | )?; | 670 | )?; |
| @@ -672,7 +672,7 @@ mod when_main_branch_is_uptodate { | |||
| 672 | p.expect("finding commits...\r\n")?; | 672 | p.expect("finding commits...\r\n")?; |
| 673 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 673 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; |
| 674 | confirm.succeeds_with(None)?; | 674 | confirm.succeeds_with(None)?; |
| 675 | p.expect("checked out PR branch. pulled 2 new commits\r\n")?; | 675 | p.expect("checked out proposal branch. pulled 2 new commits\r\n")?; |
| 676 | p.expect_end()?; | 676 | p.expect_end()?; |
| 677 | 677 | ||
| 678 | for p in [51, 52, 53, 55, 56] { | 678 | for p in [51, 52, 53, 55, 56] { |
| @@ -696,15 +696,15 @@ mod when_main_branch_is_uptodate { | |||
| 696 | 696 | ||
| 697 | #[tokio::test] | 697 | #[tokio::test] |
| 698 | #[serial] | 698 | #[serial] |
| 699 | async fn prompts_to_choose_from_pr_titles() -> Result<()> { | 699 | async fn prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 700 | let _ = run_async_prompts_to_choose_from_pr_titles().await; | 700 | let _ = run_async_prompts_to_choose_from_proposal_titles().await; |
| 701 | Ok(()) | 701 | Ok(()) |
| 702 | } | 702 | } |
| 703 | } | 703 | } |
| 704 | 704 | ||
| 705 | #[tokio::test] | 705 | #[tokio::test] |
| 706 | #[serial] | 706 | #[serial] |
| 707 | async fn pr_branch_created_with_correct_name() -> Result<()> { | 707 | async fn proposal_branch_created_with_correct_name() -> Result<()> { |
| 708 | let (_, test_repo) = prep_and_run().await?; | 708 | let (_, test_repo) = prep_and_run().await?; |
| 709 | assert_eq!( | 709 | assert_eq!( |
| 710 | vec![FEATURE_BRANCH_NAME_4, "main"], | 710 | vec![FEATURE_BRANCH_NAME_4, "main"], |
| @@ -715,7 +715,7 @@ mod when_main_branch_is_uptodate { | |||
| 715 | 715 | ||
| 716 | #[tokio::test] | 716 | #[tokio::test] |
| 717 | #[serial] | 717 | #[serial] |
| 718 | async fn pr_branch_checked_out() -> Result<()> { | 718 | async fn proposal_branch_checked_out() -> Result<()> { |
| 719 | let (_, test_repo) = prep_and_run().await?; | 719 | let (_, test_repo) = prep_and_run().await?; |
| 720 | assert_eq!( | 720 | assert_eq!( |
| 721 | FEATURE_BRANCH_NAME_4, | 721 | FEATURE_BRANCH_NAME_4, |
| @@ -726,7 +726,7 @@ mod when_main_branch_is_uptodate { | |||
| 726 | 726 | ||
| 727 | #[tokio::test] | 727 | #[tokio::test] |
| 728 | #[serial] | 728 | #[serial] |
| 729 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 729 | async fn proposal_branch_tip_is_most_recent_patch() -> Result<()> { |
| 730 | let (originating_repo, test_repo) = prep_and_run().await?; | 730 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 731 | assert_eq!( | 731 | assert_eq!( |
| 732 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_4)?, | 732 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_4)?, |
| @@ -738,7 +738,7 @@ mod when_main_branch_is_uptodate { | |||
| 738 | } | 738 | } |
| 739 | } | 739 | } |
| 740 | 740 | ||
| 741 | mod when_pr_branch_exists { | 741 | mod when_proposal_branch_exists { |
| 742 | use super::*; | 742 | use super::*; |
| 743 | 743 | ||
| 744 | mod when_main_is_checked_out { | 744 | mod when_main_is_checked_out { |
| @@ -766,7 +766,7 @@ mod when_main_branch_is_uptodate { | |||
| 766 | 766 | ||
| 767 | let cli_tester_handle = | 767 | let cli_tester_handle = |
| 768 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 768 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 769 | let originating_repo = cli_tester_create_prs()?; | 769 | let originating_repo = cli_tester_create_proposals()?; |
| 770 | 770 | ||
| 771 | let test_repo = GitTestRepo::default(); | 771 | let test_repo = GitTestRepo::default(); |
| 772 | test_repo.populate()?; | 772 | test_repo.populate()?; |
| @@ -779,13 +779,13 @@ mod when_main_branch_is_uptodate { | |||
| 779 | false, | 779 | false, |
| 780 | )?; | 780 | )?; |
| 781 | test_repo.checkout("main")?; | 781 | test_repo.checkout("main")?; |
| 782 | p.expect("finding PRs...\r\n")?; | 782 | p.expect("finding proposals...\r\n")?; |
| 783 | let mut c = p.expect_choice( | 783 | let mut c = p.expect_choice( |
| 784 | "All PRs", | 784 | "all proposals", |
| 785 | vec![ | 785 | vec![ |
| 786 | format!("\"{PR_TITLE_1}\""), | 786 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 787 | format!("\"{PR_TITLE_2}\""), | 787 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 788 | format!("\"{PR_TITLE_3}\""), | 788 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 789 | ], | 789 | ], |
| 790 | )?; | 790 | )?; |
| 791 | c.succeeds_with(0, true)?; | 791 | c.succeeds_with(0, true)?; |
| @@ -815,7 +815,7 @@ mod when_main_branch_is_uptodate { | |||
| 815 | 815 | ||
| 816 | mod cli_prompts { | 816 | mod cli_prompts { |
| 817 | use super::*; | 817 | use super::*; |
| 818 | async fn run_async_prompts_to_choose_from_pr_titles() -> Result<()> { | 818 | async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 819 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 819 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| 820 | Relay::new(8051, None, None), | 820 | Relay::new(8051, None, None), |
| 821 | Relay::new(8052, None, None), | 821 | Relay::new(8052, None, None), |
| @@ -833,7 +833,7 @@ mod when_main_branch_is_uptodate { | |||
| 833 | r55.events.push(generate_test_key_1_relay_list_event()); | 833 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 834 | 834 | ||
| 835 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 835 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 836 | cli_tester_create_prs()?; | 836 | cli_tester_create_proposals()?; |
| 837 | 837 | ||
| 838 | let test_repo = GitTestRepo::default(); | 838 | let test_repo = GitTestRepo::default(); |
| 839 | test_repo.populate()?; | 839 | test_repo.populate()?; |
| @@ -847,20 +847,20 @@ mod when_main_branch_is_uptodate { | |||
| 847 | )?; | 847 | )?; |
| 848 | test_repo.checkout("main")?; | 848 | test_repo.checkout("main")?; |
| 849 | 849 | ||
| 850 | p.expect("finding PRs...\r\n")?; | 850 | p.expect("finding proposals...\r\n")?; |
| 851 | let mut c = p.expect_choice( | 851 | let mut c = p.expect_choice( |
| 852 | "All PRs", | 852 | "all proposals", |
| 853 | vec![ | 853 | vec![ |
| 854 | format!("\"{PR_TITLE_1}\""), | 854 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 855 | format!("\"{PR_TITLE_2}\""), | 855 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 856 | format!("\"{PR_TITLE_3}\""), | 856 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 857 | ], | 857 | ], |
| 858 | )?; | 858 | )?; |
| 859 | c.succeeds_with(0, true)?; | 859 | c.succeeds_with(0, true)?; |
| 860 | p.expect("finding commits...\r\n")?; | 860 | p.expect("finding commits...\r\n")?; |
| 861 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 861 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; |
| 862 | confirm.succeeds_with(None)?; | 862 | confirm.succeeds_with(None)?; |
| 863 | p.expect("checked out PR branch. no new commits to pull\r\n")?; | 863 | p.expect("checked out proposal branch. no new commits to pull\r\n")?; |
| 864 | p.expect_end()?; | 864 | p.expect_end()?; |
| 865 | 865 | ||
| 866 | for p in [51, 52, 53, 55, 56] { | 866 | for p in [51, 52, 53, 55, 56] { |
| @@ -884,15 +884,15 @@ mod when_main_branch_is_uptodate { | |||
| 884 | 884 | ||
| 885 | #[tokio::test] | 885 | #[tokio::test] |
| 886 | #[serial] | 886 | #[serial] |
| 887 | async fn prompts_to_choose_from_pr_titles() -> Result<()> { | 887 | async fn prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 888 | let _ = run_async_prompts_to_choose_from_pr_titles().await; | 888 | let _ = run_async_prompts_to_choose_from_proposal_titles().await; |
| 889 | Ok(()) | 889 | Ok(()) |
| 890 | } | 890 | } |
| 891 | } | 891 | } |
| 892 | 892 | ||
| 893 | #[tokio::test] | 893 | #[tokio::test] |
| 894 | #[serial] | 894 | #[serial] |
| 895 | async fn pr_branch_checked_out() -> Result<()> { | 895 | async fn proposal_branch_checked_out() -> Result<()> { |
| 896 | let (_, test_repo) = prep_and_run().await?; | 896 | let (_, test_repo) = prep_and_run().await?; |
| 897 | assert_eq!( | 897 | assert_eq!( |
| 898 | FEATURE_BRANCH_NAME_1, | 898 | FEATURE_BRANCH_NAME_1, |
| @@ -925,7 +925,7 @@ mod when_main_branch_is_uptodate { | |||
| 925 | 925 | ||
| 926 | let cli_tester_handle = | 926 | let cli_tester_handle = |
| 927 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 927 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 928 | let originating_repo = cli_tester_create_prs()?; | 928 | let originating_repo = cli_tester_create_proposals()?; |
| 929 | 929 | ||
| 930 | let test_repo = GitTestRepo::default(); | 930 | let test_repo = GitTestRepo::default(); |
| 931 | test_repo.populate()?; | 931 | test_repo.populate()?; |
| @@ -939,13 +939,13 @@ mod when_main_branch_is_uptodate { | |||
| 939 | )?; | 939 | )?; |
| 940 | test_repo.checkout("main")?; | 940 | test_repo.checkout("main")?; |
| 941 | 941 | ||
| 942 | p.expect("finding PRs...\r\n")?; | 942 | p.expect("finding proposals...\r\n")?; |
| 943 | let mut c = p.expect_choice( | 943 | let mut c = p.expect_choice( |
| 944 | "All PRs", | 944 | "all proposals", |
| 945 | vec![ | 945 | vec![ |
| 946 | format!("\"{PR_TITLE_1}\""), | 946 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 947 | format!("\"{PR_TITLE_2}\""), | 947 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 948 | format!("\"{PR_TITLE_3}\""), | 948 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 949 | ], | 949 | ], |
| 950 | )?; | 950 | )?; |
| 951 | c.succeeds_with(0, true)?; | 951 | c.succeeds_with(0, true)?; |
| @@ -975,7 +975,7 @@ mod when_main_branch_is_uptodate { | |||
| 975 | 975 | ||
| 976 | mod cli_prompts { | 976 | mod cli_prompts { |
| 977 | use super::*; | 977 | use super::*; |
| 978 | async fn run_async_prompts_to_choose_from_pr_titles() -> Result<()> { | 978 | async fn run_async_prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 979 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( | 979 | let (mut r51, mut r52, mut r53, mut r55, mut r56) = ( |
| 980 | Relay::new(8051, None, None), | 980 | Relay::new(8051, None, None), |
| 981 | Relay::new(8052, None, None), | 981 | Relay::new(8052, None, None), |
| @@ -993,7 +993,7 @@ mod when_main_branch_is_uptodate { | |||
| 993 | r55.events.push(generate_test_key_1_relay_list_event()); | 993 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 994 | 994 | ||
| 995 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 995 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 996 | cli_tester_create_prs()?; | 996 | cli_tester_create_proposals()?; |
| 997 | 997 | ||
| 998 | let test_repo = GitTestRepo::default(); | 998 | let test_repo = GitTestRepo::default(); |
| 999 | test_repo.populate()?; | 999 | test_repo.populate()?; |
| @@ -1007,20 +1007,20 @@ mod when_main_branch_is_uptodate { | |||
| 1007 | )?; | 1007 | )?; |
| 1008 | test_repo.checkout("main")?; | 1008 | test_repo.checkout("main")?; |
| 1009 | 1009 | ||
| 1010 | p.expect("finding PRs...\r\n")?; | 1010 | p.expect("finding proposals...\r\n")?; |
| 1011 | let mut c = p.expect_choice( | 1011 | let mut c = p.expect_choice( |
| 1012 | "All PRs", | 1012 | "all proposals", |
| 1013 | vec![ | 1013 | vec![ |
| 1014 | format!("\"{PR_TITLE_1}\""), | 1014 | format!("\"{PROPOSAL_TITLE_1}\""), |
| 1015 | format!("\"{PR_TITLE_2}\""), | 1015 | format!("\"{PROPOSAL_TITLE_2}\""), |
| 1016 | format!("\"{PR_TITLE_3}\""), | 1016 | format!("\"{PROPOSAL_TITLE_3}\""), |
| 1017 | ], | 1017 | ], |
| 1018 | )?; | 1018 | )?; |
| 1019 | c.succeeds_with(0, true)?; | 1019 | c.succeeds_with(0, true)?; |
| 1020 | p.expect("finding commits...\r\n")?; | 1020 | p.expect("finding commits...\r\n")?; |
| 1021 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; | 1021 | let mut confirm = p.expect_confirm("check out branch?", Some(true))?; |
| 1022 | confirm.succeeds_with(None)?; | 1022 | confirm.succeeds_with(None)?; |
| 1023 | p.expect("checked out PR branch. pulled 1 new commits\r\n")?; | 1023 | p.expect("checked out proposal branch. pulled 1 new commits\r\n")?; |
| 1024 | p.expect_end()?; | 1024 | p.expect_end()?; |
| 1025 | 1025 | ||
| 1026 | for p in [51, 52, 53, 55, 56] { | 1026 | for p in [51, 52, 53, 55, 56] { |
| @@ -1044,15 +1044,15 @@ mod when_main_branch_is_uptodate { | |||
| 1044 | 1044 | ||
| 1045 | #[tokio::test] | 1045 | #[tokio::test] |
| 1046 | #[serial] | 1046 | #[serial] |
| 1047 | async fn prompts_to_choose_from_pr_titles() -> Result<()> { | 1047 | async fn prompts_to_choose_from_proposal_titles() -> Result<()> { |
| 1048 | let _ = run_async_prompts_to_choose_from_pr_titles().await; | 1048 | let _ = run_async_prompts_to_choose_from_proposal_titles().await; |
| 1049 | Ok(()) | 1049 | Ok(()) |
| 1050 | } | 1050 | } |
| 1051 | } | 1051 | } |
| 1052 | 1052 | ||
| 1053 | #[tokio::test] | 1053 | #[tokio::test] |
| 1054 | #[serial] | 1054 | #[serial] |
| 1055 | async fn pr_branch_checked_out() -> Result<()> { | 1055 | async fn proposal_branch_checked_out() -> Result<()> { |
| 1056 | let (_, test_repo) = prep_and_run().await?; | 1056 | let (_, test_repo) = prep_and_run().await?; |
| 1057 | assert_eq!( | 1057 | assert_eq!( |
| 1058 | FEATURE_BRANCH_NAME_1, | 1058 | FEATURE_BRANCH_NAME_1, |
| @@ -1063,7 +1063,7 @@ mod when_main_branch_is_uptodate { | |||
| 1063 | 1063 | ||
| 1064 | #[tokio::test] | 1064 | #[tokio::test] |
| 1065 | #[serial] | 1065 | #[serial] |
| 1066 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 1066 | async fn proposal_branch_tip_is_most_recent_patch() -> Result<()> { |
| 1067 | let (originating_repo, test_repo) = prep_and_run().await?; | 1067 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 1068 | assert_eq!( | 1068 | assert_eq!( |
| 1069 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, | 1069 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, |
| @@ -1075,8 +1075,8 @@ mod when_main_branch_is_uptodate { | |||
| 1075 | 1075 | ||
| 1076 | mod when_branch_is_ahead { | 1076 | mod when_branch_is_ahead { |
| 1077 | // use super::*; | 1077 | // use super::*; |
| 1078 | // TODO latest commit in pr builds off an older commit in pr | 1078 | // TODO latest commit in proposal builds off an older commit in |
| 1079 | // instead of previous. | 1079 | // proposal instead of previous. |
| 1080 | // TODO current git user created commit on branch | 1080 | // TODO current git user created commit on branch |
| 1081 | } | 1081 | } |
| 1082 | 1082 | ||
diff --git a/tests/pull.rs b/tests/pull.rs index d3064a3..7270908 100644 --- a/tests/pull.rs +++ b/tests/pull.rs | |||
| @@ -7,33 +7,33 @@ static FEATURE_BRANCH_NAME_1: &str = "feature-example-t"; | |||
| 7 | static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; | 7 | static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; |
| 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; | 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; |
| 9 | 9 | ||
| 10 | static PR_TITLE_1: &str = "pr a"; | 10 | static PROPOSAL_TITLE_1: &str = "proposal a"; |
| 11 | static PR_TITLE_2: &str = "pr b"; | 11 | static PROPOSAL_TITLE_2: &str = "proposal b"; |
| 12 | static PR_TITLE_3: &str = "pr c"; | 12 | static PROPOSAL_TITLE_3: &str = "proposal c"; |
| 13 | 13 | ||
| 14 | fn cli_tester_create_prs() -> Result<GitTestRepo> { | 14 | fn cli_tester_create_proposals() -> Result<GitTestRepo> { |
| 15 | let git_repo = GitTestRepo::default(); | 15 | let git_repo = GitTestRepo::default(); |
| 16 | git_repo.populate()?; | 16 | git_repo.populate()?; |
| 17 | cli_tester_create_pr( | 17 | cli_tester_create_proposal( |
| 18 | &git_repo, | 18 | &git_repo, |
| 19 | FEATURE_BRANCH_NAME_1, | 19 | FEATURE_BRANCH_NAME_1, |
| 20 | "a", | 20 | "a", |
| 21 | PR_TITLE_1, | 21 | PROPOSAL_TITLE_1, |
| 22 | "pr a description", | 22 | "proposal a description", |
| 23 | )?; | 23 | )?; |
| 24 | cli_tester_create_pr( | 24 | cli_tester_create_proposal( |
| 25 | &git_repo, | 25 | &git_repo, |
| 26 | FEATURE_BRANCH_NAME_2, | 26 | FEATURE_BRANCH_NAME_2, |
| 27 | "b", | 27 | "b", |
| 28 | PR_TITLE_2, | 28 | PROPOSAL_TITLE_2, |
| 29 | "pr b description", | 29 | "proposal b description", |
| 30 | )?; | 30 | )?; |
| 31 | cli_tester_create_pr( | 31 | cli_tester_create_proposal( |
| 32 | &git_repo, | 32 | &git_repo, |
| 33 | FEATURE_BRANCH_NAME_3, | 33 | FEATURE_BRANCH_NAME_3, |
| 34 | "c", | 34 | "c", |
| 35 | PR_TITLE_3, | 35 | PROPOSAL_TITLE_3, |
| 36 | "pr c description", | 36 | "proposal c description", |
| 37 | )?; | 37 | )?; |
| 38 | Ok(git_repo) | 38 | Ok(git_repo) |
| 39 | } | 39 | } |
| @@ -62,7 +62,7 @@ fn create_and_populate_branch( | |||
| 62 | Ok(()) | 62 | Ok(()) |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | fn cli_tester_create_pr( | 65 | fn cli_tester_create_proposal( |
| 66 | test_repo: &GitTestRepo, | 66 | test_repo: &GitTestRepo, |
| 67 | branch_name: &str, | 67 | branch_name: &str, |
| 68 | prefix: &str, | 68 | prefix: &str, |
| @@ -113,7 +113,7 @@ mod when_main_is_checked_out { | |||
| 113 | r55.events.push(generate_test_key_1_relay_list_event()); | 113 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 114 | 114 | ||
| 115 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 115 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 116 | cli_tester_create_prs()?; | 116 | cli_tester_create_proposals()?; |
| 117 | 117 | ||
| 118 | let test_repo = GitTestRepo::default(); | 118 | let test_repo = GitTestRepo::default(); |
| 119 | test_repo.populate()?; | 119 | test_repo.populate()?; |
| @@ -122,7 +122,7 @@ mod when_main_is_checked_out { | |||
| 122 | test_repo.checkout("main")?; | 122 | test_repo.checkout("main")?; |
| 123 | 123 | ||
| 124 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); | 124 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); |
| 125 | p.expect("Error: checkout a branch associated with a PR first\r\n")?; | 125 | p.expect("Error: checkout a branch associated with a proposal first\r\n")?; |
| 126 | p.expect_end()?; | 126 | p.expect_end()?; |
| 127 | 127 | ||
| 128 | for p in [51, 52, 53, 55, 56] { | 128 | for p in [51, 52, 53, 55, 56] { |
| @@ -174,7 +174,7 @@ mod when_branch_doesnt_exist { | |||
| 174 | r55.events.push(generate_test_key_1_relay_list_event()); | 174 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 175 | 175 | ||
| 176 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 176 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 177 | cli_tester_create_prs()?; | 177 | cli_tester_create_proposals()?; |
| 178 | 178 | ||
| 179 | let test_repo = GitTestRepo::default(); | 179 | let test_repo = GitTestRepo::default(); |
| 180 | test_repo.populate()?; | 180 | test_repo.populate()?; |
| @@ -183,9 +183,9 @@ mod when_branch_doesnt_exist { | |||
| 183 | test_repo.checkout("random-name")?; | 183 | test_repo.checkout("random-name")?; |
| 184 | 184 | ||
| 185 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); | 185 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); |
| 186 | p.expect("finding PR event...\r\n")?; | 186 | p.expect("finding proposal event...\r\n")?; |
| 187 | p.expect( | 187 | p.expect( |
| 188 | "Error: cannot find a PR event associated with the checked out branch name\r\n", | 188 | "Error: cannot find a proposal event associated with the checked out branch name\r\n", |
| 189 | )?; | 189 | )?; |
| 190 | 190 | ||
| 191 | p.expect_end()?; | 191 | p.expect_end()?; |
| @@ -242,7 +242,7 @@ mod when_branch_is_checked_out { | |||
| 242 | r55.events.push(generate_test_key_1_relay_list_event()); | 242 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 243 | 243 | ||
| 244 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 244 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 245 | cli_tester_create_prs()?; | 245 | cli_tester_create_proposals()?; |
| 246 | 246 | ||
| 247 | let test_repo = GitTestRepo::default(); | 247 | let test_repo = GitTestRepo::default(); |
| 248 | test_repo.populate()?; | 248 | test_repo.populate()?; |
| @@ -250,8 +250,8 @@ mod when_branch_is_checked_out { | |||
| 250 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; | 250 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; |
| 251 | 251 | ||
| 252 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); | 252 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); |
| 253 | p.expect("finding PR event...\r\n")?; | 253 | p.expect("finding proposal root event...\r\n")?; |
| 254 | p.expect("found PR event. finding commits...\r\n")?; | 254 | p.expect("found proposal root event. finding commits...\r\n")?; |
| 255 | p.expect("branch already up-to-date\r\n")?; | 255 | p.expect("branch already up-to-date\r\n")?; |
| 256 | p.expect_end()?; | 256 | p.expect_end()?; |
| 257 | 257 | ||
| @@ -304,7 +304,7 @@ mod when_branch_is_checked_out { | |||
| 304 | 304 | ||
| 305 | let cli_tester_handle = | 305 | let cli_tester_handle = |
| 306 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 306 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 307 | let originating_repo = cli_tester_create_prs()?; | 307 | let originating_repo = cli_tester_create_proposals()?; |
| 308 | 308 | ||
| 309 | let test_repo = GitTestRepo::default(); | 309 | let test_repo = GitTestRepo::default(); |
| 310 | test_repo.populate()?; | 310 | test_repo.populate()?; |
| @@ -356,7 +356,7 @@ mod when_branch_is_checked_out { | |||
| 356 | 356 | ||
| 357 | let cli_tester_handle = | 357 | let cli_tester_handle = |
| 358 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 358 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 359 | let originating_repo = cli_tester_create_prs()?; | 359 | let originating_repo = cli_tester_create_proposals()?; |
| 360 | 360 | ||
| 361 | let test_repo = GitTestRepo::default(); | 361 | let test_repo = GitTestRepo::default(); |
| 362 | test_repo.populate()?; | 362 | test_repo.populate()?; |
| @@ -364,8 +364,8 @@ mod when_branch_is_checked_out { | |||
| 364 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", true)?; | 364 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", true)?; |
| 365 | 365 | ||
| 366 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); | 366 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["pull"]); |
| 367 | p.expect("finding PR event...\r\n")?; | 367 | p.expect("finding proposal root event...\r\n")?; |
| 368 | p.expect("found PR event. finding commits...\r\n")?; | 368 | p.expect("found proposal root event. finding commits...\r\n")?; |
| 369 | p.expect("applied 1 new commits\r\n")?; | 369 | p.expect("applied 1 new commits\r\n")?; |
| 370 | p.expect_end()?; | 370 | p.expect_end()?; |
| 371 | 371 | ||
| @@ -397,7 +397,7 @@ mod when_branch_is_checked_out { | |||
| 397 | 397 | ||
| 398 | #[tokio::test] | 398 | #[tokio::test] |
| 399 | #[serial] | 399 | #[serial] |
| 400 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 400 | async fn proposal_branch_tip_is_most_recent_patch() -> Result<()> { |
| 401 | let (originating_repo, test_repo) = prep_and_run().await?; | 401 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 402 | assert_eq!( | 402 | assert_eq!( |
| 403 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, | 403 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, |
| @@ -409,7 +409,7 @@ mod when_branch_is_checked_out { | |||
| 409 | 409 | ||
| 410 | mod when_branch_is_ahead { | 410 | mod when_branch_is_ahead { |
| 411 | // use super::*; | 411 | // use super::*; |
| 412 | // TODO latest commit in pr builds off an older commit in pr | 412 | // TODO latest commit in proposal builds off an older commit in proposal |
| 413 | // instead of previous. | 413 | // instead of previous. |
| 414 | // TODO current git user created commit on branch | 414 | // TODO current git user created commit on branch |
| 415 | } | 415 | } |
diff --git a/tests/push.rs b/tests/push.rs index 07148ae..6f3a593 100644 --- a/tests/push.rs +++ b/tests/push.rs | |||
| @@ -7,33 +7,33 @@ static FEATURE_BRANCH_NAME_1: &str = "feature-example-t"; | |||
| 7 | static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; | 7 | static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; |
| 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; | 8 | static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; |
| 9 | 9 | ||
| 10 | static PR_TITLE_1: &str = "pr a"; | 10 | static PROPOSAL_TITLE_1: &str = "proposal a"; |
| 11 | static PR_TITLE_2: &str = "pr b"; | 11 | static PROPOSAL_TITLE_2: &str = "proposal b"; |
| 12 | static PR_TITLE_3: &str = "pr c"; | 12 | static PROPOSAL_TITLE_3: &str = "proposal c"; |
| 13 | 13 | ||
| 14 | fn cli_tester_create_prs() -> Result<GitTestRepo> { | 14 | fn cli_tester_create_proposals() -> Result<GitTestRepo> { |
| 15 | let git_repo = GitTestRepo::default(); | 15 | let git_repo = GitTestRepo::default(); |
| 16 | git_repo.populate()?; | 16 | git_repo.populate()?; |
| 17 | cli_tester_create_pr( | 17 | cli_tester_create_proposal( |
| 18 | &git_repo, | 18 | &git_repo, |
| 19 | FEATURE_BRANCH_NAME_1, | 19 | FEATURE_BRANCH_NAME_1, |
| 20 | "a", | 20 | "a", |
| 21 | PR_TITLE_1, | 21 | PROPOSAL_TITLE_1, |
| 22 | "pr a description", | 22 | "proposal a description", |
| 23 | )?; | 23 | )?; |
| 24 | cli_tester_create_pr( | 24 | cli_tester_create_proposal( |
| 25 | &git_repo, | 25 | &git_repo, |
| 26 | FEATURE_BRANCH_NAME_2, | 26 | FEATURE_BRANCH_NAME_2, |
| 27 | "b", | 27 | "b", |
| 28 | PR_TITLE_2, | 28 | PROPOSAL_TITLE_2, |
| 29 | "pr b description", | 29 | "proposal b description", |
| 30 | )?; | 30 | )?; |
| 31 | cli_tester_create_pr( | 31 | cli_tester_create_proposal( |
| 32 | &git_repo, | 32 | &git_repo, |
| 33 | FEATURE_BRANCH_NAME_3, | 33 | FEATURE_BRANCH_NAME_3, |
| 34 | "c", | 34 | "c", |
| 35 | PR_TITLE_3, | 35 | PROPOSAL_TITLE_3, |
| 36 | "pr c description", | 36 | "proposal c description", |
| 37 | )?; | 37 | )?; |
| 38 | Ok(git_repo) | 38 | Ok(git_repo) |
| 39 | } | 39 | } |
| @@ -62,7 +62,7 @@ fn create_and_populate_branch( | |||
| 62 | Ok(()) | 62 | Ok(()) |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | fn cli_tester_create_pr( | 65 | fn cli_tester_create_proposal( |
| 66 | test_repo: &GitTestRepo, | 66 | test_repo: &GitTestRepo, |
| 67 | branch_name: &str, | 67 | branch_name: &str, |
| 68 | prefix: &str, | 68 | prefix: &str, |
| @@ -100,13 +100,13 @@ mod when_main_is_checked_out { | |||
| 100 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; | 100 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; |
| 101 | test_repo.checkout("main")?; | 101 | test_repo.checkout("main")?; |
| 102 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); | 102 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); |
| 103 | p.expect("Error: checkout a branch associated with a PR first\r\n")?; | 103 | p.expect("Error: checkout a branch associated with a proposal first\r\n")?; |
| 104 | p.expect_end()?; | 104 | p.expect_end()?; |
| 105 | Ok(()) | 105 | Ok(()) |
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | mod when_pr_isnt_associated_with_branch_name { | 109 | mod when_proposal_isnt_associated_with_branch_name { |
| 110 | use super::*; | 110 | use super::*; |
| 111 | 111 | ||
| 112 | mod cli_prompts { | 112 | mod cli_prompts { |
| @@ -130,7 +130,7 @@ mod when_pr_isnt_associated_with_branch_name { | |||
| 130 | r55.events.push(generate_test_key_1_relay_list_event()); | 130 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 131 | 131 | ||
| 132 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 132 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 133 | cli_tester_create_prs()?; | 133 | cli_tester_create_proposals()?; |
| 134 | 134 | ||
| 135 | let test_repo = GitTestRepo::default(); | 135 | let test_repo = GitTestRepo::default(); |
| 136 | test_repo.populate()?; | 136 | test_repo.populate()?; |
| @@ -139,9 +139,9 @@ mod when_pr_isnt_associated_with_branch_name { | |||
| 139 | test_repo.checkout("random-name")?; | 139 | test_repo.checkout("random-name")?; |
| 140 | 140 | ||
| 141 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); | 141 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); |
| 142 | p.expect("finding PR event...\r\n")?; | 142 | p.expect("finding proposal root event...\r\n")?; |
| 143 | p.expect( | 143 | p.expect( |
| 144 | "Error: cannot find a PR event associated with the checked out branch name\r\n", | 144 | "Error: cannot find a proposal root event associated with the checked out branch name\r\n", |
| 145 | )?; | 145 | )?; |
| 146 | 146 | ||
| 147 | p.expect_end()?; | 147 | p.expect_end()?; |
| @@ -198,7 +198,7 @@ mod when_branch_is_checked_out { | |||
| 198 | r55.events.push(generate_test_key_1_relay_list_event()); | 198 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 199 | 199 | ||
| 200 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 200 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 201 | cli_tester_create_prs()?; | 201 | cli_tester_create_proposals()?; |
| 202 | 202 | ||
| 203 | let test_repo = GitTestRepo::default(); | 203 | let test_repo = GitTestRepo::default(); |
| 204 | test_repo.populate()?; | 204 | test_repo.populate()?; |
| @@ -206,9 +206,9 @@ mod when_branch_is_checked_out { | |||
| 206 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; | 206 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", false)?; |
| 207 | 207 | ||
| 208 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); | 208 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); |
| 209 | p.expect("finding PR event...\r\n")?; | 209 | p.expect("finding proposal root event...\r\n")?; |
| 210 | p.expect("found PR event. finding commits...\r\n")?; | 210 | p.expect("found proposal root event. finding commits...\r\n")?; |
| 211 | p.expect("Error: nostr pr already up-to-date with local branch\r\n")?; | 211 | p.expect("Error: nostr proposal already up-to-date with local branch\r\n")?; |
| 212 | p.expect_end()?; | 212 | p.expect_end()?; |
| 213 | 213 | ||
| 214 | for p in [51, 52, 53, 55, 56] { | 214 | for p in [51, 52, 53, 55, 56] { |
| @@ -261,7 +261,7 @@ mod when_branch_is_checked_out { | |||
| 261 | r55.events.push(generate_test_key_1_relay_list_event()); | 261 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 262 | 262 | ||
| 263 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 263 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 264 | cli_tester_create_prs()?; | 264 | cli_tester_create_proposals()?; |
| 265 | 265 | ||
| 266 | let test_repo = GitTestRepo::default(); | 266 | let test_repo = GitTestRepo::default(); |
| 267 | test_repo.populate()?; | 267 | test_repo.populate()?; |
| @@ -269,9 +269,9 @@ mod when_branch_is_checked_out { | |||
| 269 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", true)?; | 269 | create_and_populate_branch(&test_repo, FEATURE_BRANCH_NAME_1, "a", true)?; |
| 270 | 270 | ||
| 271 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); | 271 | let mut p = CliTester::new_from_dir(&test_repo.dir, ["push"]); |
| 272 | p.expect("finding PR event...\r\n")?; | 272 | p.expect("finding proposal root event...\r\n")?; |
| 273 | p.expect("found PR event. finding commits...\r\n")?; | 273 | p.expect("found proposal root event. finding commits...\r\n")?; |
| 274 | p.expect("Error: nostr pr is ahead of local branch\r\n")?; | 274 | p.expect("Error: nostr proposal is ahead of local branch\r\n")?; |
| 275 | p.expect_end()?; | 275 | p.expect_end()?; |
| 276 | 276 | ||
| 277 | for p in [51, 52, 53, 55, 56] { | 277 | for p in [51, 52, 53, 55, 56] { |
| @@ -329,7 +329,7 @@ mod when_branch_is_checked_out { | |||
| 329 | 329 | ||
| 330 | let cli_tester_handle = | 330 | let cli_tester_handle = |
| 331 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { | 331 | std::thread::spawn(move || -> Result<(GitTestRepo, GitTestRepo)> { |
| 332 | let originating_repo = cli_tester_create_prs()?; | 332 | let originating_repo = cli_tester_create_proposals()?; |
| 333 | 333 | ||
| 334 | let test_repo = GitTestRepo::default(); | 334 | let test_repo = GitTestRepo::default(); |
| 335 | test_repo.populate()?; | 335 | test_repo.populate()?; |
| @@ -350,8 +350,8 @@ mod when_branch_is_checked_out { | |||
| 350 | "push", | 350 | "push", |
| 351 | ], | 351 | ], |
| 352 | ); | 352 | ); |
| 353 | p.expect("finding PR event...\r\n")?; | 353 | p.expect("finding proposal root event...\r\n")?; |
| 354 | p.expect("found PR event. finding commits...\r\n")?; | 354 | p.expect("found proposal root event. finding commits...\r\n")?; |
| 355 | p.expect( | 355 | p.expect( |
| 356 | "1 commits ahead. preparing to create creating patch events.\r\n", | 356 | "1 commits ahead. preparing to create creating patch events.\r\n", |
| 357 | )?; | 357 | )?; |
| @@ -420,7 +420,7 @@ mod when_branch_is_checked_out { | |||
| 420 | r55.events.push(generate_test_key_1_relay_list_event()); | 420 | r55.events.push(generate_test_key_1_relay_list_event()); |
| 421 | 421 | ||
| 422 | let cli_tester_handle = std::thread::spawn(move || -> Result<GitTestRepo> { | 422 | let cli_tester_handle = std::thread::spawn(move || -> Result<GitTestRepo> { |
| 423 | cli_tester_create_prs()?; | 423 | cli_tester_create_proposals()?; |
| 424 | 424 | ||
| 425 | let test_repo = GitTestRepo::default(); | 425 | let test_repo = GitTestRepo::default(); |
| 426 | test_repo.populate()?; | 426 | test_repo.populate()?; |
diff --git a/tests/send.rs b/tests/send.rs index 6d3e138..9c8561a 100644 --- a/tests/send.rs +++ b/tests/send.rs | |||
| @@ -159,7 +159,7 @@ fn prep_git_repo() -> Result<GitTestRepo> { | |||
| 159 | Ok(test_repo) | 159 | Ok(test_repo) |
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | fn cli_tester_create_pr(git_repo: &GitTestRepo, include_cover_letter: bool) -> CliTester { | 162 | fn cli_tester_create_proposal(git_repo: &GitTestRepo, include_cover_letter: bool) -> CliTester { |
| 163 | let mut args = vec![ | 163 | let mut args = vec![ |
| 164 | "--nsec", | 164 | "--nsec", |
| 165 | TEST_KEY_1_NSEC, | 165 | TEST_KEY_1_NSEC, |
| @@ -199,7 +199,7 @@ fn expect_msgs_first(p: &mut CliTester, include_cover_letter: bool) -> Result<() | |||
| 199 | Ok(()) | 199 | Ok(()) |
| 200 | } | 200 | } |
| 201 | 201 | ||
| 202 | async fn prep_run_create_pr( | 202 | async fn prep_run_create_proposal( |
| 203 | include_cover_letter: bool, | 203 | include_cover_letter: bool, |
| 204 | ) -> Result<( | 204 | ) -> Result<( |
| 205 | Relay<'static>, | 205 | Relay<'static>, |
| @@ -245,7 +245,7 @@ async fn prep_run_create_pr( | |||
| 245 | 245 | ||
| 246 | // // check relay had the right number of events | 246 | // // check relay had the right number of events |
| 247 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 247 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 248 | let mut p = cli_tester_create_pr(&git_repo, include_cover_letter); | 248 | let mut p = cli_tester_create_proposal(&git_repo, include_cover_letter); |
| 249 | p.expect_end_eventually()?; | 249 | p.expect_end_eventually()?; |
| 250 | for p in [51, 52, 53, 55, 56] { | 250 | for p in [51, 52, 53, 55, 56] { |
| 251 | relay::shutdown_relay(8000 + p)?; | 251 | relay::shutdown_relay(8000 + p)?; |
| @@ -270,8 +270,8 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 270 | use super::*; | 270 | use super::*; |
| 271 | #[tokio::test] | 271 | #[tokio::test] |
| 272 | #[serial] | 272 | #[serial] |
| 273 | async fn only_1_pr_kind_event_sent_to_each_relay() -> Result<()> { | 273 | async fn only_1_cover_letter_event_sent_to_each_relay() -> Result<()> { |
| 274 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 274 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 275 | for relay in [&r53, &r55, &r56] { | 275 | for relay in [&r53, &r55, &r56] { |
| 276 | assert_eq!( | 276 | assert_eq!( |
| 277 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), | 277 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), |
| @@ -283,8 +283,8 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 283 | 283 | ||
| 284 | #[tokio::test] | 284 | #[tokio::test] |
| 285 | #[serial] | 285 | #[serial] |
| 286 | async fn only_1_pr_kind_event_sent_to_user_relays() -> Result<()> { | 286 | async fn only_1_cover_letter_event_sent_to_user_relays() -> Result<()> { |
| 287 | let (_, _, r53, r55, _) = prep_run_create_pr(true).await?; | 287 | let (_, _, r53, r55, _) = prep_run_create_proposal(true).await?; |
| 288 | for relay in [&r53, &r55] { | 288 | for relay in [&r53, &r55] { |
| 289 | assert_eq!( | 289 | assert_eq!( |
| 290 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), | 290 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), |
| @@ -296,8 +296,8 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 296 | 296 | ||
| 297 | #[tokio::test] | 297 | #[tokio::test] |
| 298 | #[serial] | 298 | #[serial] |
| 299 | async fn only_1_pr_kind_event_sent_to_repo_relays() -> Result<()> { | 299 | async fn only_1_cover_letter_event_sent_to_repo_relays() -> Result<()> { |
| 300 | let (_, _, _, r55, r56) = prep_run_create_pr(true).await?; | 300 | let (_, _, _, r55, r56) = prep_run_create_proposal(true).await?; |
| 301 | for relay in [&r55, &r56] { | 301 | for relay in [&r55, &r56] { |
| 302 | assert_eq!( | 302 | assert_eq!( |
| 303 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), | 303 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), |
| @@ -309,8 +309,8 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 309 | 309 | ||
| 310 | #[tokio::test] | 310 | #[tokio::test] |
| 311 | #[serial] | 311 | #[serial] |
| 312 | async fn only_1_pr_kind_event_sent_to_fallback_relays() -> Result<()> { | 312 | async fn only_1_cover_letter_event_sent_to_fallback_relays() -> Result<()> { |
| 313 | let (r51, r52, _, _, _) = prep_run_create_pr(true).await?; | 313 | let (r51, r52, _, _, _) = prep_run_create_proposal(true).await?; |
| 314 | for relay in [&r51, &r52] { | 314 | for relay in [&r51, &r52] { |
| 315 | assert_eq!( | 315 | assert_eq!( |
| 316 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), | 316 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), |
| @@ -323,7 +323,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 323 | #[tokio::test] | 323 | #[tokio::test] |
| 324 | #[serial] | 324 | #[serial] |
| 325 | async fn only_2_patch_kind_events_sent_to_each_relay() -> Result<()> { | 325 | async fn only_2_patch_kind_events_sent_to_each_relay() -> Result<()> { |
| 326 | let (r51, r52, r53, r55, r56) = prep_run_create_pr(true).await?; | 326 | let (r51, r52, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 327 | for relay in [&r51, &r52, &r53, &r55, &r56] { | 327 | for relay in [&r51, &r52, &r53, &r55, &r56] { |
| 328 | assert_eq!(relay.events.iter().filter(|e| is_patch(e)).count(), 2,); | 328 | assert_eq!(relay.events.iter().filter(|e| is_patch(e)).count(), 2,); |
| 329 | } | 329 | } |
| @@ -334,7 +334,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 334 | #[serial] | 334 | #[serial] |
| 335 | async fn patch_content_contains_patch_in_email_format_with_patch_series_numbers() -> Result<()> | 335 | async fn patch_content_contains_patch_in_email_format_with_patch_series_numbers() -> Result<()> |
| 336 | { | 336 | { |
| 337 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 337 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 338 | for relay in [&r53, &r55, &r56] { | 338 | for relay in [&r53, &r55, &r56] { |
| 339 | let patch_events: Vec<&nostr::Event> = | 339 | let patch_events: Vec<&nostr::Event> = |
| 340 | relay.events.iter().filter(|e| is_patch(e)).collect(); | 340 | relay.events.iter().filter(|e| is_patch(e)).collect(); |
| @@ -395,19 +395,19 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 395 | Ok(()) | 395 | Ok(()) |
| 396 | } | 396 | } |
| 397 | 397 | ||
| 398 | mod pr_tags { | 398 | mod cover_letter_tags { |
| 399 | use super::*; | 399 | use super::*; |
| 400 | 400 | ||
| 401 | #[tokio::test] | 401 | #[tokio::test] |
| 402 | #[serial] | 402 | #[serial] |
| 403 | async fn root_commit_as_r() -> Result<()> { | 403 | async fn root_commit_as_r() -> Result<()> { |
| 404 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 404 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 405 | for relay in [&r53, &r55, &r56] { | 405 | for relay in [&r53, &r55, &r56] { |
| 406 | let pr_event: &nostr::Event = | 406 | let cover_letter_event: &nostr::Event = |
| 407 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 407 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 408 | 408 | ||
| 409 | assert_eq!( | 409 | assert_eq!( |
| 410 | pr_event | 410 | cover_letter_event |
| 411 | .iter_tags() | 411 | .iter_tags() |
| 412 | .find(|t| t.as_vec()[0].eq("r")) | 412 | .find(|t| t.as_vec()[0].eq("r")) |
| 413 | .unwrap() | 413 | .unwrap() |
| @@ -421,11 +421,11 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 421 | #[tokio::test] | 421 | #[tokio::test] |
| 422 | #[serial] | 422 | #[serial] |
| 423 | async fn a_tag_for_repo_event() -> Result<()> { | 423 | async fn a_tag_for_repo_event() -> Result<()> { |
| 424 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 424 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 425 | for relay in [&r53, &r55, &r56] { | 425 | for relay in [&r53, &r55, &r56] { |
| 426 | let pr_event: &nostr::Event = | 426 | let cover_letter_event: &nostr::Event = |
| 427 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 427 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 428 | assert!(pr_event.iter_tags().any(|t| t.as_vec()[0].eq("a") | 428 | assert!(cover_letter_event.iter_tags().any(|t| t.as_vec()[0].eq("a") |
| 429 | && t.as_vec()[1].eq(&format!( | 429 | && t.as_vec()[1].eq(&format!( |
| 430 | "{REPOSITORY_KIND}:{TEST_KEY_1_PUBKEY_HEX}:{}", | 430 | "{REPOSITORY_KIND}:{TEST_KEY_1_PUBKEY_HEX}:{}", |
| 431 | generate_repo_ref_event().identifier().unwrap() | 431 | generate_repo_ref_event().identifier().unwrap() |
| @@ -443,13 +443,13 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 443 | .unwrap() | 443 | .unwrap() |
| 444 | .as_vec() | 444 | .as_vec() |
| 445 | .clone()[1..]; | 445 | .clone()[1..]; |
| 446 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 446 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 447 | for relay in [&r53, &r55, &r56] { | 447 | for relay in [&r53, &r55, &r56] { |
| 448 | for m in maintainers { | 448 | for m in maintainers { |
| 449 | let pr_event: &nostr::Event = | 449 | let cover_letter_event: &nostr::Event = |
| 450 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 450 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 451 | assert!( | 451 | assert!( |
| 452 | pr_event | 452 | cover_letter_event |
| 453 | .iter_tags() | 453 | .iter_tags() |
| 454 | .any(|t| { t.as_vec()[0].eq("p") && t.as_vec()[1].eq(m) }) | 454 | .any(|t| { t.as_vec()[0].eq("p") && t.as_vec()[1].eq(m) }) |
| 455 | ); | 455 | ); |
| @@ -461,12 +461,12 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 461 | #[tokio::test] | 461 | #[tokio::test] |
| 462 | #[serial] | 462 | #[serial] |
| 463 | async fn t_tag_cover_letter() -> Result<()> { | 463 | async fn t_tag_cover_letter() -> Result<()> { |
| 464 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 464 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 465 | for relay in [&r53, &r55, &r56] { | 465 | for relay in [&r53, &r55, &r56] { |
| 466 | let pr_event: &nostr::Event = | 466 | let cover_letter_event: &nostr::Event = |
| 467 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 467 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 468 | assert!( | 468 | assert!( |
| 469 | pr_event | 469 | cover_letter_event |
| 470 | .iter_tags() | 470 | .iter_tags() |
| 471 | .any(|t| { t.as_vec()[0].eq("t") && t.as_vec()[1].eq(&"cover-letter") }) | 471 | .any(|t| { t.as_vec()[0].eq("t") && t.as_vec()[1].eq(&"cover-letter") }) |
| 472 | ); | 472 | ); |
| @@ -477,12 +477,12 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 477 | #[tokio::test] | 477 | #[tokio::test] |
| 478 | #[serial] | 478 | #[serial] |
| 479 | async fn t_tag_root() -> Result<()> { | 479 | async fn t_tag_root() -> Result<()> { |
| 480 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 480 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 481 | for relay in [&r53, &r55, &r56] { | 481 | for relay in [&r53, &r55, &r56] { |
| 482 | let pr_event: &nostr::Event = | 482 | let cover_letter_event: &nostr::Event = |
| 483 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 483 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 484 | assert!( | 484 | assert!( |
| 485 | pr_event | 485 | cover_letter_event |
| 486 | .iter_tags() | 486 | .iter_tags() |
| 487 | .any(|t| { t.as_vec()[0].eq("t") && t.as_vec()[1].eq(&"root") }) | 487 | .any(|t| { t.as_vec()[0].eq("t") && t.as_vec()[1].eq(&"root") }) |
| 488 | ); | 488 | ); |
| @@ -493,14 +493,14 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 493 | #[tokio::test] | 493 | #[tokio::test] |
| 494 | #[serial] | 494 | #[serial] |
| 495 | async fn pr_tags_branch_name() -> Result<()> { | 495 | async fn pr_tags_branch_name() -> Result<()> { |
| 496 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 496 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 497 | for relay in [&r53, &r55, &r56] { | 497 | for relay in [&r53, &r55, &r56] { |
| 498 | let pr_event: &nostr::Event = | 498 | let cover_letter_event: &nostr::Event = |
| 499 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 499 | relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 500 | 500 | ||
| 501 | // branch-name tag | 501 | // branch-name tag |
| 502 | assert_eq!( | 502 | assert_eq!( |
| 503 | pr_event | 503 | cover_letter_event |
| 504 | .iter_tags() | 504 | .iter_tags() |
| 505 | .find(|t| t.as_vec()[0].eq("branch-name")) | 505 | .find(|t| t.as_vec()[0].eq("branch-name")) |
| 506 | .unwrap() | 506 | .unwrap() |
| @@ -516,7 +516,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 516 | use super::*; | 516 | use super::*; |
| 517 | 517 | ||
| 518 | async fn prep() -> Result<nostr::Event> { | 518 | async fn prep() -> Result<nostr::Event> { |
| 519 | let (_, _, r53, _, _) = prep_run_create_pr(true).await?; | 519 | let (_, _, r53, _, _) = prep_run_create_proposal(true).await?; |
| 520 | Ok(r53.events.iter().find(|e| is_patch(e)).unwrap().clone()) | 520 | Ok(r53.events.iter().find(|e| is_patch(e)).unwrap().clone()) |
| 521 | } | 521 | } |
| 522 | 522 | ||
| @@ -649,14 +649,14 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 649 | 649 | ||
| 650 | #[tokio::test] | 650 | #[tokio::test] |
| 651 | #[serial] | 651 | #[serial] |
| 652 | async fn patch_tags_pr_event_as_root() -> Result<()> { | 652 | async fn patch_tags_cover_letter_event_as_root() -> Result<()> { |
| 653 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 653 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 654 | for relay in [&r53, &r55, &r56] { | 654 | for relay in [&r53, &r55, &r56] { |
| 655 | let patch_events: Vec<&nostr::Event> = | 655 | let patch_events: Vec<&nostr::Event> = |
| 656 | relay.events.iter().filter(|e| is_patch(e)).collect(); | 656 | relay.events.iter().filter(|e| is_patch(e)).collect(); |
| 657 | 657 | ||
| 658 | let most_recent_patch = patch_events[0]; | 658 | let most_recent_patch = patch_events[0]; |
| 659 | let pr_event = relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); | 659 | let cover_letter_event = relay.events.iter().find(|e| is_cover_letter(e)).unwrap(); |
| 660 | 660 | ||
| 661 | let root_event_tag = most_recent_patch | 661 | let root_event_tag = most_recent_patch |
| 662 | .tags | 662 | .tags |
| @@ -666,7 +666,10 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 666 | }) | 666 | }) |
| 667 | .unwrap(); | 667 | .unwrap(); |
| 668 | 668 | ||
| 669 | assert_eq!(root_event_tag.as_vec()[1], pr_event.id.to_string()); | 669 | assert_eq!( |
| 670 | root_event_tag.as_vec()[1], | ||
| 671 | cover_letter_event.id.to_string() | ||
| 672 | ); | ||
| 670 | } | 673 | } |
| 671 | Ok(()) | 674 | Ok(()) |
| 672 | } | 675 | } |
| @@ -674,7 +677,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 674 | #[tokio::test] | 677 | #[tokio::test] |
| 675 | #[serial] | 678 | #[serial] |
| 676 | async fn second_patch_tags_first_with_reply() -> Result<()> { | 679 | async fn second_patch_tags_first_with_reply() -> Result<()> { |
| 677 | let (_, _, r53, r55, r56) = prep_run_create_pr(true).await?; | 680 | let (_, _, r53, r55, r56) = prep_run_create_proposal(true).await?; |
| 678 | for relay in [&r53, &r55, &r56] { | 681 | for relay in [&r53, &r55, &r56] { |
| 679 | let patch_events = relay | 682 | let patch_events = relay |
| 680 | .events | 683 | .events |
| @@ -749,7 +752,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 749 | 752 | ||
| 750 | // // check relay had the right number of events | 753 | // // check relay had the right number of events |
| 751 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 754 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 752 | let mut p = cli_tester_create_pr(&git_repo, true); | 755 | let mut p = cli_tester_create_proposal(&git_repo, true); |
| 753 | expect_msgs_first(&mut p, true)?; | 756 | expect_msgs_first(&mut p, true)?; |
| 754 | relay::expect_send_with_progress( | 757 | relay::expect_send_with_progress( |
| 755 | &mut p, | 758 | &mut p, |
| @@ -840,7 +843,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 840 | 843 | ||
| 841 | // // check relay had the right number of events | 844 | // // check relay had the right number of events |
| 842 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 845 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 843 | let mut p = cli_tester_create_pr(&git_repo, true); | 846 | let mut p = cli_tester_create_proposal(&git_repo, true); |
| 844 | p.expect_end_eventually()?; | 847 | p.expect_end_eventually()?; |
| 845 | for p in [51, 52, 53, 55, 56] { | 848 | for p in [51, 52, 53, 55, 56] { |
| 846 | relay::shutdown_relay(8000 + p)?; | 849 | relay::shutdown_relay(8000 + p)?; |
| @@ -919,7 +922,7 @@ mod sends_cover_letter_and_2_patches_to_3_relays { | |||
| 919 | 922 | ||
| 920 | // // check relay had the right number of events | 923 | // // check relay had the right number of events |
| 921 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 924 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 922 | let mut p = cli_tester_create_pr(&git_repo, true); | 925 | let mut p = cli_tester_create_proposal(&git_repo, true); |
| 923 | expect_msgs_first(&mut p, true)?; | 926 | expect_msgs_first(&mut p, true)?; |
| 924 | // p.expect_end_with("bla")?; | 927 | // p.expect_end_with("bla")?; |
| 925 | relay::expect_send_with_progress( | 928 | relay::expect_send_with_progress( |
| @@ -1011,7 +1014,7 @@ mod sends_2_patches_without_cover_letter { | |||
| 1011 | 1014 | ||
| 1012 | // // check relay had the right number of events | 1015 | // // check relay had the right number of events |
| 1013 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { | 1016 | let cli_tester_handle = std::thread::spawn(move || -> Result<()> { |
| 1014 | let mut p = cli_tester_create_pr(&git_repo, false); | 1017 | let mut p = cli_tester_create_proposal(&git_repo, false); |
| 1015 | 1018 | ||
| 1016 | expect_msgs_first(&mut p, false)?; | 1019 | expect_msgs_first(&mut p, false)?; |
| 1017 | relay::expect_send_with_progress( | 1020 | relay::expect_send_with_progress( |
| @@ -1055,7 +1058,7 @@ mod sends_2_patches_without_cover_letter { | |||
| 1055 | #[tokio::test] | 1058 | #[tokio::test] |
| 1056 | #[serial] | 1059 | #[serial] |
| 1057 | async fn no_cover_letter_event() -> Result<()> { | 1060 | async fn no_cover_letter_event() -> Result<()> { |
| 1058 | let (_, _, r53, r55, r56) = prep_run_create_pr(false).await?; | 1061 | let (_, _, r53, r55, r56) = prep_run_create_proposal(false).await?; |
| 1059 | for relay in [&r53, &r55, &r56] { | 1062 | for relay in [&r53, &r55, &r56] { |
| 1060 | assert_eq!( | 1063 | assert_eq!( |
| 1061 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), | 1064 | relay.events.iter().filter(|e| is_cover_letter(e)).count(), |
| @@ -1068,7 +1071,7 @@ mod sends_2_patches_without_cover_letter { | |||
| 1068 | #[tokio::test] | 1071 | #[tokio::test] |
| 1069 | #[serial] | 1072 | #[serial] |
| 1070 | async fn two_patch_events() -> Result<()> { | 1073 | async fn two_patch_events() -> Result<()> { |
| 1071 | let (_, _, r53, r55, r56) = prep_run_create_pr(false).await?; | 1074 | let (_, _, r53, r55, r56) = prep_run_create_proposal(false).await?; |
| 1072 | for relay in [&r53, &r55, &r56] { | 1075 | for relay in [&r53, &r55, &r56] { |
| 1073 | assert_eq!(relay.events.iter().filter(|e| is_patch(e)).count(), 2); | 1076 | assert_eq!(relay.events.iter().filter(|e| is_patch(e)).count(), 2); |
| 1074 | } | 1077 | } |
| @@ -1079,7 +1082,7 @@ mod sends_2_patches_without_cover_letter { | |||
| 1079 | #[serial] | 1082 | #[serial] |
| 1080 | // TODO check this is the ancestor | 1083 | // TODO check this is the ancestor |
| 1081 | async fn first_patch_with_root_t_tag() -> Result<()> { | 1084 | async fn first_patch_with_root_t_tag() -> Result<()> { |
| 1082 | let (_, _, r53, r55, r56) = prep_run_create_pr(false).await?; | 1085 | let (_, _, r53, r55, r56) = prep_run_create_proposal(false).await?; |
| 1083 | for relay in [&r53, &r55, &r56] { | 1086 | for relay in [&r53, &r55, &r56] { |
| 1084 | let patch_events = relay | 1087 | let patch_events = relay |
| 1085 | .events | 1088 | .events |
| @@ -1106,7 +1109,7 @@ mod sends_2_patches_without_cover_letter { | |||
| 1106 | #[tokio::test] | 1109 | #[tokio::test] |
| 1107 | #[serial] | 1110 | #[serial] |
| 1108 | async fn second_patch_lists_first_as_root() -> Result<()> { | 1111 | async fn second_patch_lists_first_as_root() -> Result<()> { |
| 1109 | let (_, _, r53, r55, r56) = prep_run_create_pr(false).await?; | 1112 | let (_, _, r53, r55, r56) = prep_run_create_proposal(false).await?; |
| 1110 | for relay in [&r53, &r55, &r56] { | 1113 | for relay in [&r53, &r55, &r56] { |
| 1111 | let patch_events = relay | 1114 | let patch_events = relay |
| 1112 | .events | 1115 | .events |