Repository navigation
Expand file tree
/
Copy pathparse_test.go
More file actions
79 lines (72 loc) · 1.97 KB
/
Copy pathparse_test.go
File metadata and controls
79 lines (72 loc) · 1.97 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package cmd
import (
"testing"
"github.com/context-dot-dev/context-dev-cli/internal/mocktest"
"github.com/context-dot-dev/context-dev-cli/internal/requestflag"
)
func TestParseHandle(t *testing.T) {
t.Skip("Mock server tests are disabled")
t.Run("regular flags", func(t *testing.T) {
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"parse", "handle",
"--body", mocktest.TestFile(t, "Example data"),
"--client", "x",
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf", "{end: 1, start: 1}",
"--shorten-base64-images=true",
"--tag", "production",
"--tag", "team-alpha",
"--use-main-content-only=true",
"--zdr", "enabled",
)
})
t.Run("inner flags", func(t *testing.T) {
// Check that inner flags have been set up correctly
requestflag.CheckInnerFlags(parseHandle)
// Alternative argument passing style using inner flags
mocktest.TestRunMockTestWithFlags(
t,
"--api-key", "string",
"parse", "handle",
"--body", mocktest.TestFile(t, "Example data"),
"--client", "x",
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf.end", "1",
"--pdf.start", "1",
"--shorten-base64-images=true",
"--tag", "production",
"--tag", "team-alpha",
"--use-main-content-only=true",
"--zdr", "enabled",
)
})
t.Run("piping data", func(t *testing.T) {
// Test piping YAML data over stdin
pipeData := []byte("Example data")
mocktest.TestRunMockTestWithPipeAndFlags(
t, pipeData,
"--api-key", "string",
"parse", "handle",
"--client", "x",
"--extension", "txt",
"--include-images=true",
"--include-links=true",
"--ocr=true",
"--pdf", "{end: 1, start: 1}",
"--shorten-base64-images=true",
"--tag", "production",
"--tag", "team-alpha",
"--use-main-content-only=true",
"--zdr", "enabled",
)
})
}