(t *testing.T)
| 86 | } |
| 87 | |
| 88 | func TestToMap(t *testing.T) { |
| 89 | dt := sampleForExport(t) |
| 90 | out := dt.ToMap() |
| 91 | assert.NotNil(t, out) |
| 92 | |
| 93 | expected := `[ |
| 94 | { "Client ID":1, "Nom":"Aimée MARECHAL", "email":"aime.marechal@example.com", "ville":"Paris" }, |
| 95 | { "Client ID":2, "Nom":"Esmée LEFORT", "email":"esmee.lefort@example.com", "ville":"Lyon" }, |
| 96 | { "Client ID":3, "Nom":"Marine PREVOST", "email":"m.prevost@example.com", "ville":"Lille" }, |
| 97 | { "Client ID":4, "Nom":"Luc ROLLAND", "email":"lucrolland@example.com", "ville":"Marseille" } |
| 98 | ]` |
| 99 | |
| 100 | bytes, err := json.Marshal(out) |
| 101 | assert.NoError(t, err) |
| 102 | assert.JSONEq(t, expected, string(bytes)) |
| 103 | |
| 104 | out2 := dt.ToMap(datatable.ExportHidden(true)) |
| 105 | assert.NotNil(t, out2) |
| 106 | |
| 107 | expected2 := `[ |
| 108 | { "Client ID":1, "prenom": "Aimée", "nom": "Marechal", "Nom":"Aimée MARECHAL", "email":"aime.marechal@example.com", "ville":"Paris" }, |
| 109 | { "Client ID":2, "prenom": "Esmée", "nom": "Lefort", "Nom":"Esmée LEFORT", "email":"esmee.lefort@example.com", "ville":"Lyon" }, |
| 110 | { "Client ID":3, "prenom": "Marine", "nom": "Prevost", "Nom":"Marine PREVOST", "email":"m.prevost@example.com", "ville":"Lille" }, |
| 111 | { "Client ID":4, "prenom": "Luc", "nom": "Rolland", "Nom":"Luc ROLLAND", "email":"lucrolland@example.com", "ville":"Marseille" } |
| 112 | ]` |
| 113 | |
| 114 | bytes, err = json.Marshal(out2) |
| 115 | assert.NoError(t, err) |
| 116 | assert.JSONEq(t, expected2, string(bytes)) |
| 117 | } |
| 118 | |
| 119 | func TestToSchema(t *testing.T) { |
| 120 | dt := sampleForExport(t) |
nothing calls this directly
no test coverage detected