From 1f94cf9dac2284cc4642275abf2f725da9ce28ea Mon Sep 17 00:00:00 2001 From: William Martin Date: Mon, 14 Oct 2024 14:31:24 +0200 Subject: [PATCH] Acceptance test PR list --- acceptance/testdata/pr/pr-create-basic.txtar | 2 +- acceptance/testdata/pr/pr-list.txtar | 24 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 acceptance/testdata/pr/pr-list.txtar diff --git a/acceptance/testdata/pr/pr-create-basic.txtar b/acceptance/testdata/pr/pr-create-basic.txtar index 46d1de990..98bb2faa9 100644 --- a/acceptance/testdata/pr/pr-create-basic.txtar +++ b/acceptance/testdata/pr/pr-create-basic.txtar @@ -20,5 +20,5 @@ exec git push -u origin feature-branch exec gh pr create --title 'Feature Title' --body 'Feature Body' # Check the PR is indeed created -exec gh pr list +exec gh pr view stdout 'Feature Title' diff --git a/acceptance/testdata/pr/pr-list.txtar b/acceptance/testdata/pr/pr-list.txtar new file mode 100644 index 000000000..6fcd8e6b7 --- /dev/null +++ b/acceptance/testdata/pr/pr-list.txtar @@ -0,0 +1,24 @@ +# Use gh as a credential helper +exec gh auth setup-git + +# Create a repository with a file so it has a default branch +exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private + +# Defer repo cleanup +defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING + +# Clone the repo +exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING + +# Prepare a branch to PR +cd $SCRIPT_NAME-$RANDOM_STRING +exec git checkout -b feature-branch +exec git commit --allow-empty -m 'Empty Commit' +exec git push -u origin feature-branch + +# Create the PR +exec gh pr create --title 'Feature Title' --body 'Feature Body' + +# List PRs and see the new PR is in the list +exec gh pr list +stdout 'Feature Title\tfeature-branch\tOPEN'