Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions e2e/core.bats
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,22 @@ load test_helper
}


# JQ flag

@test "--jq implies --json" {
run basecamp --jq '.'
assert_success
is_valid_json
assert_json_not_null '.data.version'
}

@test "--jq extracts scalar" {
run basecamp --jq '.data.auth.status'
assert_success
[[ "$output" == "unauthenticated" ]]
}


# Error handling

@test "basecamp unknown command shows error" {
Expand Down
21 changes: 21 additions & 0 deletions e2e/errors.bats
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,27 @@ load test_helper
}


# JQ flag errors

@test "--jq invalid expression shows error" {
create_credentials
run basecamp --jq '.[invalid'
assert_failure
assert_json_value '.ok' 'false'
assert_json_value '.code' 'usage'
assert_output_contains "invalid --jq expression"
}

@test "--jq conflicts with --ids-only" {
create_credentials
run basecamp --jq '.data' --ids-only
assert_failure
assert_json_value '.ok' 'false'
assert_json_value '.code' 'usage'
assert_json_value '.error' 'cannot use --jq with --ids-only'
}


# Missing content errors

@test "todo create without content shows error" {
Expand Down
Loading