upleb.uk

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

summaryrefslogtreecommitdiff
path: root/tests/push.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/push.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/push.rs')
-rw-r--r--tests/push.rs62
1 files changed, 31 insertions, 31 deletions
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";
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,
@@ -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
109mod when_pr_isnt_associated_with_branch_name { 109mod 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()?;