Implement acceptance tests for search commands
This commit is contained in:
parent
2850835b26
commit
b361cf4495
2 changed files with 28 additions and 0 deletions
|
|
@ -72,6 +72,15 @@ 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 testScriptParamsFor(tsEnv testScriptEnv, command string) testscript.Params {
|
||||
var files []string
|
||||
if tsEnv.script != "" {
|
||||
|
|
|
|||
19
acceptance/testdata/search/search-issues.txtar
vendored
Normal file
19
acceptance/testdata/search/search-issues.txtar
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# 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 'Feature 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 'Feature Body $RANDOM_STRING' -R $ORG/$SCRIPT_NAME-$RANDOM_STRING
|
||||
stdout 'Feature Request'
|
||||
Loading…
Add table
Add a link
Reference in a new issue