File size: 1,631 Bytes
6a7089a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# 22-tabs-errors.sh β€” Tab error handling via CLI

source "$(dirname "$0")/common.sh"

# ─────────────────────────────────────────────────────────────────
start_test "pinchtab tab returns valid JSON array"

pt_ok tab
assert_output_json "tabs output is valid JSON"
assert_output_contains "tabs" "response contains tabs field"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "pinchtab tab new + close roundtrip"

# Use nav to create a tab in the existing instance (returns tabId reliably)
pt_ok nav "${FIXTURES_URL}/index.html"
assert_output_json
TAB_ID=$(echo "$PT_OUT" | jq -r '.tabId')

pt_ok tab close "$TAB_ID"

# Verify tab is gone
pt_ok tab
assert_output_not_contains "$TAB_ID" "closed tab no longer in list"

end_test

# ─────────────────────────────────────────────────────────────────
start_test "pinchtab tab close with no args β†’ error"

pt_fail tab close

end_test

# ─────────────────────────────────────────────────────────────────
start_test "pinchtab tab close nonexistent β†’ error"

pt_fail tab close "nonexistent_tab_id_12345"

end_test