Skip to content

Commit 265a2c2

Browse files
committed
test(dataset): add tests for convertToCaseSensitiveObject
1 parent 95536c1 commit 265a2c2

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

frontend/src/app/utils/__tests__/chartHelper.test.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,5 +468,30 @@ describe('Chart Helper ', () => {
468468
).toEqual(1);
469469
expect(chartDataSet[0].getCellByKey('AVG(age)')).toEqual('r1-c2-v');
470470
});
471+
472+
test('should get dataset row data with case sensitive', () => {
473+
const columns = [['r1-c1-v', 'r1-c2-v']];
474+
const metas = [{ name: 'name' }, { name: 'avg(age)' }];
475+
const chartDataSet = transformToDataSet(columns, metas, [
476+
{
477+
rows: [
478+
{
479+
colName: 'Name',
480+
},
481+
{
482+
colName: 'Age',
483+
aggregate: 'AVG',
484+
},
485+
],
486+
},
487+
] as any);
488+
489+
expect(chartDataSet?.length).toEqual(1);
490+
expect(chartDataSet[0] instanceof ChartDataSetRow).toBeTruthy();
491+
expect(chartDataSet[0].convertToCaseSensitiveObject()).toEqual({
492+
Name: 'r1-c1-v',
493+
'AVG(Age)': 'r1-c2-v',
494+
});
495+
});
471496
});
472497
});

0 commit comments

Comments
 (0)