Skip to content

Commit 73d5735

Browse files
test(datagrid-web): assert Birth year is a numeric cell, not a string
Split sheet_to_json into raw:true and raw:false passes. The raw pass verifies t:"n" cell type (the core bug fix); the formatted pass verifies display values. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent ccc7df9 commit 73d5735

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

packages/pluggableWidgets/datagrid-web/e2e/DataGrid.spec.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,26 @@ test.describe("datagrid-web export to Excel", () => {
2020
// Read file and convert to JSON.
2121
const workbook = XLSX.readFile("./e2e/downloads/testFilename.xlsx");
2222
const worksheet = workbook.Sheets[workbook.SheetNames[0]];
23-
const jsonData = XLSX.utils.sheet_to_json(worksheet, { raw: false });
23+
const rawData = XLSX.utils.sheet_to_json(worksheet, { raw: true });
24+
const formattedData = XLSX.utils.sheet_to_json(worksheet, { raw: false });
2425

25-
expect(jsonData).toHaveLength(50);
26+
expect(rawData).toHaveLength(50);
2627

27-
expect(jsonData[0]).toEqual({
28+
// Verify raw cell types — numbers must be t:"n", not t:"s"
29+
expect(rawData[0]["Birth year"]).toBe(1983);
30+
expect(typeof rawData[0]["Birth year"]).toBe("number");
31+
expect(rawData[1]["Birth year"]).toBe(1970);
32+
expect(typeof rawData[1]["Birth year"]).toBe("number");
33+
34+
// Verify formatted display values
35+
expect(formattedData[0]).toEqual({
2836
"Birth date": "2/15/1983",
2937
"Birth year": "1983",
3038
"Color (enum)": "Black",
3139
"First name": "Loretta"
3240
});
3341

34-
expect(jsonData[1]).toEqual({
42+
expect(formattedData[1]).toEqual({
3543
"Birth date": "9/30/1970",
3644
"Birth year": "1970",
3745
"Color (enum)": "Red",

0 commit comments

Comments
 (0)