grafana/public/app/plugins/datasource/dashboard/runSharedRequest.test.ts
Hugo Häggmark b51e28bc15
Chore: reduces strict null errors to 824 (#22744)
* Chore: reduces strict null errors with 100+

* Chore: lowers the build error number
2020-03-12 10:22:33 +01:00

23 lines
754 B
TypeScript

import { isSharedDashboardQuery } from './runSharedRequest';
import { DataSourceApi } from '@grafana/data';
describe('SharedQueryRunner', () => {
it('should identify shared queries', () => {
expect(isSharedDashboardQuery('-- Dashboard --')).toBe(true);
expect(isSharedDashboardQuery('')).toBe(false);
expect(isSharedDashboardQuery((undefined as unknown) as string | DataSourceApi)).toBe(false);
expect(isSharedDashboardQuery((null as unknown) as string | DataSourceApi)).toBe(false);
const ds = {
meta: {
name: '-- Dashboard --',
},
} as DataSourceApi;
expect(isSharedDashboardQuery(ds)).toBe(true);
ds.meta!.name = 'something else';
expect(isSharedDashboardQuery(ds)).toBe(false);
});
});