(t *testing.T)
| 54 | } |
| 55 | |
| 56 | func TestToTable(t *testing.T) { |
| 57 | dt := sampleForExport(t) |
| 58 | out := dt.ToTable() |
| 59 | assert.NotNil(t, out) |
| 60 | |
| 61 | expected := `[ |
| 62 | ["Client ID", "Nom", "email", "ville"], |
| 63 | [1, "Aimée MARECHAL", "aime.marechal@example.com", "Paris"], |
| 64 | [2, "Esmée LEFORT", "esmee.lefort@example.com", "Lyon"], |
| 65 | [3, "Marine PREVOST", "m.prevost@example.com", "Lille"], |
| 66 | [4, "Luc ROLLAND", "lucrolland@example.com", "Marseille"] |
| 67 | ]` |
| 68 | |
| 69 | bytes, err := json.Marshal(out) |
| 70 | assert.NoError(t, err) |
| 71 | assert.JSONEq(t, expected, string(bytes)) |
| 72 | |
| 73 | out2 := dt.ToTable(datatable.ExportHidden(true)) |
| 74 | assert.NotNil(t, out2) |
| 75 | |
| 76 | expected2 := `[ |
| 77 | ["Client ID", "prenom", "nom", "Nom", "email", "ville"], |
| 78 | [1, "Aimée", "Marechal", "Aimée MARECHAL", "aime.marechal@example.com", "Paris"], |
| 79 | [2, "Esmée", "Lefort", "Esmée LEFORT", "esmee.lefort@example.com", "Lyon"], |
| 80 | [3, "Marine", "Prevost", "Marine PREVOST", "m.prevost@example.com", "Lille"], |
| 81 | [4, "Luc", "Rolland", "Luc ROLLAND", "lucrolland@example.com", "Marseille"] |
| 82 | ]` |
| 83 | bytes, err = json.Marshal(out2) |
| 84 | assert.NoError(t, err) |
| 85 | assert.JSONEq(t, expected2, string(bytes)) |
| 86 | } |
| 87 | |
| 88 | func TestToMap(t *testing.T) { |
| 89 | dt := sampleForExport(t) |
nothing calls this directly
no test coverage detected