upleb.uk

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

summaryrefslogtreecommitdiff
path: root/test_utils
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-08-06 10:12:26 +0100
committerDanConwayDev <DanConwayDev@protonmail.com>2024-08-06 10:59:24 +0100
commitf1aa1be738af0dc80eb3b5827249bb537de1e0cd (patch)
tree4974673e04f6b05484450bbad44c545ca73bd27b /test_utils
parent5ee6a65d7f095d5ba2d40e47bd97b2e65ed2443f (diff)
feat(remote): `list` includes open proposals
and filters out other branches in `prs/*` namespace
Diffstat (limited to 'test_utils')
-rw-r--r--test_utils/src/lib.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs
index f463652..ff3833d 100644
--- a/test_utils/src/lib.rs
+++ b/test_utils/src/lib.rs
@@ -1020,6 +1020,13 @@ pub fn get_proposal_branch_name(
1020 .hashtag("root"), 1020 .hashtag("root"),
1021 ], 1021 ],
1022 ))?; 1022 ))?;
1023 get_proposal_branch_name_from_events(&events, branch_name_in_event)
1024}
1025
1026pub fn get_proposal_branch_name_from_events(
1027 events: &Vec<nostr::Event>,
1028 branch_name_in_event: &str,
1029) -> Result<String> {
1023 for event in events { 1030 for event in events {
1024 if event.iter_tags().any(|t| { 1031 if event.iter_tags().any(|t| {
1025 !t.as_vec()[1].eq("revision-root") 1032 !t.as_vec()[1].eq("revision-root")
@@ -1075,6 +1082,15 @@ pub fn cli_tester_create_proposals() -> Result<GitTestRepo> {
1075 Ok(git_repo) 1082 Ok(git_repo)
1076} 1083}
1077 1084
1085pub fn cli_tester_create_proposal_branches_ready_to_send() -> Result<GitTestRepo> {
1086 let git_repo = GitTestRepo::default();
1087 git_repo.populate()?;
1088 create_and_populate_branch(&git_repo, FEATURE_BRANCH_NAME_1, "a", false)?;
1089 create_and_populate_branch(&git_repo, FEATURE_BRANCH_NAME_2, "b", false)?;
1090 create_and_populate_branch(&git_repo, FEATURE_BRANCH_NAME_3, "c", false)?;
1091 Ok(git_repo)
1092}
1093
1078pub fn create_and_populate_branch( 1094pub fn create_and_populate_branch(
1079 test_repo: &GitTestRepo, 1095 test_repo: &GitTestRepo,
1080 branch_name: &str, 1096 branch_name: &str,