MCPcopy Index your code
hub / github.com/databus23/helm-diff / TestPrintDyffReport

Function TestPrintDyffReport

diff/report_test.go:40–68  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

38}
39
40func TestPrintDyffReport(t *testing.T) {
41 report := &Report{
42 Entries: []ReportEntry{
43 {
44 Key: "default, nginx, Deployment (apps)",
45 Kind: "Deployment",
46 ChangeType: "MODIFY",
47 Diffs: []difflib.DiffRecord{
48 {Payload: "apiVersion: apps/v1", Delta: difflib.Common},
49 {Payload: "kind: Deployment", Delta: difflib.Common},
50 {Payload: "metadata:", Delta: difflib.Common},
51 {Payload: " name: nginx", Delta: difflib.Common},
52 {Payload: "spec:", Delta: difflib.Common},
53 {Payload: " replicas: 2", Delta: difflib.LeftOnly},
54 {Payload: " replicas: 3", Delta: difflib.RightOnly},
55 },
56 },
57 },
58 }
59
60 var buf bytes.Buffer
61 printDyffReport(report, &buf)
62
63 output := buf.String()
64 require.NotEmpty(t, output)
65 require.Contains(t, output, "replicas", "Expected dyff output to mention replicas field")
66 require.Contains(t, output, "- 2", "Expected dyff output to show original replicas value")
67 require.Contains(t, output, "+ 3", "Expected dyff output to show updated replicas value")
68}
69
70func TestPrintDyffReportWithAddAndRemove(t *testing.T) {
71 report := &Report{

Callers

nothing calls this directly

Calls 2

printDyffReportFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected