(t *testing.T)
| 38 | } |
| 39 | |
| 40 | func 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 | |
| 70 | func TestPrintDyffReportWithAddAndRemove(t *testing.T) { |
| 71 | report := &Report{ |
nothing calls this directly
no test coverage detected