MCPcopy
hub / github.com/yannh/kubeconform / TestPrettyTextWrite

Function TestPrettyTextWrite

pkg/output/pretty_test.go:11–84  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

9)
10
11func TestPrettyTextWrite(t *testing.T) {
12 for _, testCase := range []struct {
13 name string
14 withSummary bool
15 isStdin bool
16 verbose bool
17 results []validator.Result
18 expect string
19 }{
20 {
21 "a single deployment, no summary, no verbose",
22 false,
23 false,
24 false,
25 []validator.Result{},
26 "",
27 },
28 {
29 "a single deployment, summary, no verbose",
30 true,
31 false,
32 false,
33 []validator.Result{
34 {
35 Resource: resource.Resource{
36 Path: "deployment.yml",
37 Bytes: []byte(`apiVersion: apps/v1
38kind: Deployment
39metadata:
40 name: "my-app"
41`),
42 },
43 Status: validator.Valid,
44 Err: nil,
45 },
46 },
47 "Summary: 1 resource found in 1 file - Valid: 1, Invalid: 0, Errors: 0, Skipped: 0\n",
48 },
49 {
50 "a single deployment, verbose, with summary",
51 true,
52 false,
53 true,
54 []validator.Result{
55 {
56 Resource: resource.Resource{
57 Path: "deployment.yml",
58 Bytes: []byte(`apiVersion: apps/v1
59kind: Deployment
60metadata:
61 name: "my-app"
62`),
63 },
64 Status: validator.Valid,
65 Err: nil,
66 },
67 },
68 "\033[32m✔\033[0m deployment.yml: \033[32mDeployment my-app is valid\033[0m\n" +

Callers

nothing calls this directly

Calls 4

prettyOutputFunction · 0.85
WriteMethod · 0.65
FlushMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected