Test: add empty test case in sheet utils (#76168)

add empty test case in sheet utils
This commit is contained in:
Krishna Dhakal 2023-10-09 12:43:40 +05:45 committed by GitHub
parent ef82767dab
commit 69142bffe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,6 +5,15 @@ import { DataFrame } from '@grafana/data';
import { workSheetToFrame } from './sheet';
describe('sheets', () => {
it('should handle an empty sheet', () => {
const emptySheet = utils.aoa_to_sheet([]);
const frame = workSheetToFrame(emptySheet);
expect(frame.name).toBeUndefined();
expect(frame.fields).toHaveLength(0);
expect(frame.length).toBe(0);
});
it('will use first row as names', () => {
const sheet = utils.aoa_to_sheet([
['Number', 'String', 'Bool', 'Date', 'Object'],