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/list.rs | |
| 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/list.rs')
| -rw-r--r-- | tests/list.rs | 236 |
1 files changed, 118 insertions, 118 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 | ||