(t *testing.T)
| 68 | } |
| 69 | |
| 70 | func TestPrintDyffReportWithAddAndRemove(t *testing.T) { |
| 71 | report := &Report{ |
| 72 | Entries: []ReportEntry{ |
| 73 | { |
| 74 | Key: "default, old-app, Deployment (apps)", |
| 75 | Kind: "Deployment", |
| 76 | ChangeType: "REMOVE", |
| 77 | Diffs: []difflib.DiffRecord{ |
| 78 | {Payload: "apiVersion: apps/v1", Delta: difflib.LeftOnly}, |
| 79 | {Payload: "kind: Deployment", Delta: difflib.LeftOnly}, |
| 80 | {Payload: "metadata:", Delta: difflib.LeftOnly}, |
| 81 | {Payload: " name: old-app", Delta: difflib.LeftOnly}, |
| 82 | }, |
| 83 | }, |
| 84 | { |
| 85 | Key: "default, new-app, Deployment (apps)", |
| 86 | Kind: "Deployment", |
| 87 | ChangeType: "ADD", |
| 88 | Diffs: []difflib.DiffRecord{ |
| 89 | {Payload: "apiVersion: apps/v1", Delta: difflib.RightOnly}, |
| 90 | {Payload: "kind: Deployment", Delta: difflib.RightOnly}, |
| 91 | {Payload: "metadata:", Delta: difflib.RightOnly}, |
| 92 | {Payload: " name: new-app", Delta: difflib.RightOnly}, |
| 93 | }, |
| 94 | }, |
| 95 | }, |
| 96 | } |
| 97 | |
| 98 | var buf bytes.Buffer |
| 99 | printDyffReport(report, &buf) |
| 100 | |
| 101 | output := buf.String() |
| 102 | require.NotEmpty(t, output) |
| 103 | require.Contains(t, output, "old-app", "Expected dyff output to show removed resource old-app") |
| 104 | require.Contains(t, output, "new-app", "Expected dyff output to show added resource new-app") |
| 105 | } |
| 106 | |
| 107 | func TestPrintDyffReportAddRemoveDiffersFromModify(t *testing.T) { |
| 108 | addRemoveReport := &Report{ |
nothing calls this directly
no test coverage detected