Merge pull request #9786 from cli/kw/github-cli-590-add-search-acceptance-tests

Add acceptance tests for `search` command
This commit is contained in:
Kynan Ware 2024-10-21 10:34:19 -06:00 committed by GitHub
commit d2a9d1c90b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 0 deletions

View file

@ -72,11 +72,21 @@ func TestReleases(t *testing.T) {
testscript.Run(t, testScriptParamsFor(tsEnv, "release"))
}
func TestSearches(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
t.Fatal(err)
}
testscript.Run(t, testScriptParamsFor(tsEnv, "search"))
}
func TestRepo(t *testing.T) {
var tsEnv testScriptEnv
if err := tsEnv.fromEnv(); err != nil {
t.Fatal(err)
}
testscript.Run(t, testScriptParamsFor(tsEnv, "repo"))
}

View file

@ -0,0 +1,20 @@
# 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
# Create an issue in the repo
cd $SCRIPT_NAME-$RANDOM_STRING
exec gh issue create --title 'Feature Request' --body $RANDOM_STRING
# It takes some time for the issue to be created and indexed
sleep 5
# Search for the issue
exec gh search issues $RANDOM_STRING -R $ORG/$SCRIPT_NAME-$RANDOM_STRING
stdout $RANDOM_STRING