|
|
|
@ -15,8 +15,9 @@ jest.mock('uuid', () => ({ |
|
|
|
|
const originalLog = console.log; |
|
|
|
|
const originalWarn = console.warn; |
|
|
|
|
beforeEach(() => { |
|
|
|
|
//jest.spyOn(console, 'log').mockImplementation(() => {});
|
|
|
|
|
jest.spyOn(console, 'log').mockImplementation(() => {}); |
|
|
|
|
jest.spyOn(console, 'warn').mockImplementation(() => {}); |
|
|
|
|
jest.spyOn(console, 'error').mockImplementation(() => {}); |
|
|
|
|
}); |
|
|
|
|
afterAll(() => { |
|
|
|
|
console.log = originalLog; |
|
|
|
@ -182,6 +183,16 @@ describe('runShardSplitQuery()', () => { |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Failed requests have loading state Error', async () => { |
|
|
|
|
jest.mocked(datasource.languageProvider.fetchLabelValues).mockResolvedValue(['1']); |
|
|
|
|
jest |
|
|
|
|
.spyOn(datasource, 'runQuery') |
|
|
|
|
.mockReturnValue(of({ state: LoadingState.Error, error: { refId: 'A', message: 'parse error' }, data: [] })); |
|
|
|
|
await expect(runShardSplitQuery(datasource, request)).toEmitValuesWith((response: DataQueryResponse[]) => { |
|
|
|
|
expect(response[0].state).toBe(LoadingState.Error); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
test('Does not retry on other errors', async () => { |
|
|
|
|
jest.mocked(datasource.languageProvider.fetchLabelValues).mockResolvedValue(['1']); |
|
|
|
|
jest |
|
|
|
|