The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/features/dataframe-import/utils.test.ts

39 lines
981 B

import { formatFileTypes } from './utils';
describe('Dataframe import / Utils', () => {
describe('formatFileTypes', () => {
it('should nicely format file extensions', () => {
expect(
formatFileTypes({
'text/plain': ['.csv', '.txt'],
'application/json': ['.json'],
})
).toBe('.csv, .txt or .json');
});
it('should remove duplicates', () => {
expect(
formatFileTypes({
'text/plain': ['.csv', '.txt'],
'application/json': ['.json', '.txt'],
})
).toBe('.csv, .txt or .json');
});
it('should nicely format a single file type extension', () => {
expect(
formatFileTypes({
'text/plain': ['.txt'],
})
).toBe('.txt');
});
it('should nicely format two file type extension', () => {
expect(
formatFileTypes({
'text/plain': ['.txt', '.csv'],
})
).toBe('.txt or .csv');
});
});
});