[CSV Export] Verify CSV data content

This commit is contained in:
Victor Woeltjen
2016-02-05 14:03:15 -08:00
parent 54c67b891c
commit 300d71ddc2

View File

@@ -68,7 +68,19 @@ define(
}); });
it("includes headers from the data set", function () { it("includes headers from the data set", function () {
expect(csvContents[0]).toEqual([ 'a', 'b', 'c' ]); expect(csvContents[0])
.toEqual(Object.keys(testRows[0]).sort());
});
it("includes data from the data set", function () {
var headers = csvContents[0],
expectedData = testRows.map(function (row) {
return headers.map(function (key) {
return String(row[key]);
});
});
// Everything after header should be data
expect(csvContents.slice(1)).toEqual(expectedData);
}); });
}); });