Skip to content

Commit ae7ce65

Browse files
committed
Expand goreleaser brews test block
Cover: version, help, unauthenticated search+jq, locations, auth errors, missing key, invalid archive ID (offline), api_error.
1 parent b90ce24 commit ae7ce65

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

.goreleaser.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,13 @@ brews:
5858
bin.install "serpapi"
5959
test: |
6060
assert_match version.to_s, shell_output("#{bin}/serpapi --version")
61+
assert_match "search", shell_output("#{bin}/serpapi --help")
62+
assert_match "organic_results", shell_output("#{bin}/serpapi search q=coffee")
63+
assert_match "google", shell_output("#{bin}/serpapi search q=coffee --jq .search_parameters.engine")
64+
assert_match "canonical_name", shell_output("#{bin}/serpapi locations q=Austin")
65+
assert_match "Invalid API key", shell_output("#{bin}/serpapi --api-key invalid search q=coffee 2>&1", 1)
66+
assert_match "Invalid API key", shell_output("#{bin}/serpapi --api-key invalid account 2>&1", 1)
67+
assert_match "No API key", shell_output("#{bin}/serpapi account 2>&1", 2)
68+
assert_match "No API key", shell_output("#{bin}/serpapi archive abc123 2>&1", 2)
69+
assert_match "Invalid archive ID", shell_output("#{bin}/serpapi --api-key x archive ../bad 2>&1", 2)
70+
assert_match "api_error", shell_output("#{bin}/serpapi --api-key invalid archive abc123 2>&1", 1)

0 commit comments

Comments
 (0)