From e7549c93f9c4069b30173320b007ca330ee9161d Mon Sep 17 00:00:00 2001 From: Tyler McGoffin Date: Thu, 17 Oct 2024 13:36:19 -0700 Subject: [PATCH] Cleanup some inconsistencies and improve collapse some functionality --- .../testdata/repos/repo-archive-unarchive.txtar | 2 +- acceptance/testdata/repos/repo-clone.txtar | 2 +- acceptance/testdata/repos/repo-create-view.txtar | 4 ++-- acceptance/testdata/repos/repo-delete.txtar | 2 +- acceptance/testdata/repos/repo-deploy-key.txtar | 1 - acceptance/testdata/repos/repo-edit.txtar | 4 ++-- acceptance/testdata/repos/repo-fork-sync.txtar | 2 +- acceptance/testdata/repos/repo-list-rename.txtar | 15 +++++---------- acceptance/testdata/repos/repo-set-default.txtar | 11 ++++------- 9 files changed, 17 insertions(+), 26 deletions(-) diff --git a/acceptance/testdata/repos/repo-archive-unarchive.txtar b/acceptance/testdata/repos/repo-archive-unarchive.txtar index d72b36906..de1f7df9f 100644 --- a/acceptance/testdata/repos/repo-archive-unarchive.txtar +++ b/acceptance/testdata/repos/repo-archive-unarchive.txtar @@ -23,4 +23,4 @@ exec gh repo unarchive $ORG/$SCRIPT_NAME-$RANDOM_STRING --yes # Check that the repo is unarchived exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json=isArchived --jq='.isArchived' -stdout false \ No newline at end of file +stdout false diff --git a/acceptance/testdata/repos/repo-clone.txtar b/acceptance/testdata/repos/repo-clone.txtar index f0bad8e01..5afc3ab0e 100644 --- a/acceptance/testdata/repos/repo-clone.txtar +++ b/acceptance/testdata/repos/repo-clone.txtar @@ -12,4 +12,4 @@ exec gh repo clone $ORG/$SCRIPT_NAME-$RANDOM_STRING # Ensure the repo was cloned exec ls $SCRIPT_NAME-$RANDOM_STRING -stdout README.md \ No newline at end of file +stdout README.md diff --git a/acceptance/testdata/repos/repo-create-view.txtar b/acceptance/testdata/repos/repo-create-view.txtar index b5b85f593..f1a67ac73 100644 --- a/acceptance/testdata/repos/repo-create-view.txtar +++ b/acceptance/testdata/repos/repo-create-view.txtar @@ -8,5 +8,5 @@ exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING # Check that the repo exists -exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json name --jq '.name' -stdout $SCRIPT_NAME-$RANDOM_STRING \ No newline at end of file +exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json=name --jq='.name' +stdout $SCRIPT_NAME-$RANDOM_STRING diff --git a/acceptance/testdata/repos/repo-delete.txtar b/acceptance/testdata/repos/repo-delete.txtar index 855473ae9..c9fd2c058 100644 --- a/acceptance/testdata/repos/repo-delete.txtar +++ b/acceptance/testdata/repos/repo-delete.txtar @@ -13,4 +13,4 @@ exec gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING # Ensure that the repo was deleted ! exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json name --jq '.name' -stderr 'Could not resolve to a Repository with the name' \ No newline at end of file +stderr 'Could not resolve to a Repository with the name' diff --git a/acceptance/testdata/repos/repo-deploy-key.txtar b/acceptance/testdata/repos/repo-deploy-key.txtar index 69c2efef8..42c5b1746 100644 --- a/acceptance/testdata/repos/repo-deploy-key.txtar +++ b/acceptance/testdata/repos/repo-deploy-key.txtar @@ -32,4 +32,3 @@ exec gh repo deploy-key list --json=id --jq='.[].id' -- deployKey.pub -- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAZmdeRNskfpvYL5YHB/YJaW8hTEXpnvPMkx5Ri+YwUr myTitle - diff --git a/acceptance/testdata/repos/repo-edit.txtar b/acceptance/testdata/repos/repo-edit.txtar index c8e293cc0..3fd5a48f6 100644 --- a/acceptance/testdata/repos/repo-edit.txtar +++ b/acceptance/testdata/repos/repo-edit.txtar @@ -9,11 +9,11 @@ defer gh repo delete --yes $ORG/$SCRIPT_NAME-$RANDOM_STRING # Check that the repo description is empty exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json description --jq '.description' -stdout '' +! stdout '.' # Edit the repo description exec gh repo edit $ORG/$SCRIPT_NAME-$RANDOM_STRING --description 'newDescription' # Check that the repo description is updated exec gh repo view $ORG/$SCRIPT_NAME-$RANDOM_STRING --json description --jq '.description' -stdout 'newDescription' \ No newline at end of file +stdout 'newDescription' diff --git a/acceptance/testdata/repos/repo-fork-sync.txtar b/acceptance/testdata/repos/repo-fork-sync.txtar index 73beb39f1..8bc437567 100644 --- a/acceptance/testdata/repos/repo-fork-sync.txtar +++ b/acceptance/testdata/repos/repo-fork-sync.txtar @@ -41,4 +41,4 @@ exec ls stdout asset.txt -- asset.txt -- -Hello, world! \ No newline at end of file +Hello, world! diff --git a/acceptance/testdata/repos/repo-list-rename.txtar b/acceptance/testdata/repos/repo-list-rename.txtar index e758ac7fd..972e5a74a 100644 --- a/acceptance/testdata/repos/repo-list-rename.txtar +++ b/acceptance/testdata/repos/repo-list-rename.txtar @@ -5,20 +5,15 @@ exec gh auth setup-git exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private # List the repos and check for the new repo -exec gh repo list $ORG --json name --jq '.[].name' +exec gh repo list $ORG --json=name --jq='.[].name' stdout $SCRIPT_NAME-$RANDOM_STRING # Rename the repo exec gh repo rename $SCRIPT_NAME-$RANDOM_STRING-renamed --repo=$ORG/$SCRIPT_NAME-$RANDOM_STRING --yes +# Defer repo deletion +defer gh repo delete $ORG/$SCRIPT_NAME-$RANDOM_STRING-renamed --yes + # List the repos and check for the renamed repo -exec gh repo list $ORG --json name --jq '.[].name' +exec gh repo list $ORG --json=name --jq='.[].name' stdout $SCRIPT_NAME-$RANDOM_STRING-renamed - -# Delete the renamed repo -exec gh repo delete $ORG/$SCRIPT_NAME-$RANDOM_STRING-renamed --yes - -# List the repos and check for the deleted repo -exec gh repo list $ORG --json name --jq '.[].name' -! stdout $SCRIPT_NAME-$RANDOM_STRING-renamed - diff --git a/acceptance/testdata/repos/repo-set-default.txtar b/acceptance/testdata/repos/repo-set-default.txtar index f8c0e68c5..c5b16b9ac 100644 --- a/acceptance/testdata/repos/repo-set-default.txtar +++ b/acceptance/testdata/repos/repo-set-default.txtar @@ -1,17 +1,14 @@ # 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 +# Create and clone a repository with a file so it has a default branch +exec gh repo create $ORG/$SCRIPT_NAME-$RANDOM_STRING --add-readme --private --clone # 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 -cd $SCRIPT_NAME-$RANDOM_STRING - # Ensure that no default is set +cd $SCRIPT_NAME-$RANDOM_STRING exec gh repo set-default --view stderr 'no default repository has been set; use `gh repo set-default` to select one' @@ -20,4 +17,4 @@ exec gh repo set-default $ORG/$SCRIPT_NAME-$RANDOM_STRING # Check that the default is set exec gh repo set-default --view -stdout $ORG/$SCRIPT_NAME-$RANDOM_STRING \ No newline at end of file +stdout $ORG/$SCRIPT_NAME-$RANDOM_STRING