upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/pull.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-02-16 22:31:29 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-02-16 22:31:29 +0000
commit701668b02d999af42f51d8bd25fffb2a8692c3c8 (patch)
tree7defd0e7e711d743c8464994c2223a7a332ccf2a /tests/pull.rs
parent61ffbf2008c0aaaee3d19ac027d63bca823dc8c9 (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/pull.rs')
-rw-r--r--tests/pull.rs56
1 files changed, 28 insertions, 28 deletions
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";
7static FEATURE_BRANCH_NAME_2: &str = "feature-example-f"; 7static FEATURE_BRANCH_NAME_2: &str = "feature-example-f";
8static FEATURE_BRANCH_NAME_3: &str = "feature-example-c"; 8static FEATURE_BRANCH_NAME_3: &str = "feature-example-c";
9 9
10static PR_TITLE_1: &str = "pr a"; 10static PROPOSAL_TITLE_1: &str = "proposal a";
11static PR_TITLE_2: &str = "pr b"; 11static PROPOSAL_TITLE_2: &str = "proposal b";
12static PR_TITLE_3: &str = "pr c"; 12static PROPOSAL_TITLE_3: &str = "proposal c";
13 13
14fn cli_tester_create_prs() -> Result<GitTestRepo> { 14fn 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
65fn cli_tester_create_pr( 65fn 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 }