mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 16:45:43 -06:00
* Explore: adds QueryRowErrors component * Explore: updates QueryRow to use QueryRowErrors component * Explore: updates PromQueryField to remove error render * Explore: updates Elastic query field to remove error render * Explore: updates LokiQueryFieldForm to remove error render * Explore: updates QueryRow component - brings back passing errors down * Explore: removes QueryRowErrors component * Explore: updates ErrorContainer component - moves out data filtering * Explore: updates QueryRow component - changes QueryRowErrors to ErrorContainer * Explore: updates Explore component - adds error filtering for ErrorContainer * Explore: updates ErrorContainer and adds a basic test for it * Explore: updates Explore component props name and adds a basic render test * Explore: adds snapshots for Explore and ErrorContainer * Explore: adds a test for error render * Explore: adds a comment to Explore component explaining the way we filter non-query-row-specific errors * Explore: adds getFirstNonQueryRowSpecificError method to explore utilities * Explore: extracts getFirstNonQueryRowSpecificError method and slightly refactors Explore component * Explore: updates Explore component tests to cover non-query-row-specific errors
37 lines
913 B
TypeScript
37 lines
913 B
TypeScript
import React from 'react';
|
|
import { DataQueryError } from '@grafana/data';
|
|
import { shallow } from 'enzyme';
|
|
import { ErrorContainer } from './ErrorContainer';
|
|
|
|
const makeError = (propOverrides?: DataQueryError): DataQueryError => {
|
|
const queryError: DataQueryError = {
|
|
data: {
|
|
message: 'Error data message',
|
|
error: 'Error data content',
|
|
},
|
|
message: 'Error message',
|
|
status: 'Error status',
|
|
statusText: 'Error status text',
|
|
refId: 'A',
|
|
cancelled: false,
|
|
};
|
|
Object.assign(queryError, propOverrides);
|
|
return queryError;
|
|
};
|
|
|
|
const setup = (propOverrides?: object) => {
|
|
const props = {
|
|
queryError: makeError(propOverrides),
|
|
};
|
|
|
|
const wrapper = shallow(<ErrorContainer {...props} />);
|
|
return wrapper;
|
|
};
|
|
|
|
describe('ErrorContainer', () => {
|
|
it('should render component', () => {
|
|
const wrapper = setup();
|
|
expect(wrapper).toMatchSnapshot();
|
|
});
|
|
});
|