mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Stub console.warn (#45311)
This commit is contained in:
parent
6a776c78d4
commit
378ce15418
@ -3,7 +3,18 @@ import { CustomEndpointTransport } from './CustomEndpointTransport';
|
||||
|
||||
describe('CustomEndpointTransport', () => {
|
||||
const fetchSpy = (window.fetch = jest.fn());
|
||||
beforeEach(() => jest.resetAllMocks());
|
||||
let consoleSpy: jest.SpyInstance;
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
// The code logs a warning to console
|
||||
// Let's stub this out so we don't pollute the test output
|
||||
consoleSpy = jest.spyOn(console, 'warn').mockImplementation(() => {});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
consoleSpy.mockRestore();
|
||||
});
|
||||
const now = new Date();
|
||||
|
||||
const event: Event = {
|
||||
@ -87,7 +98,7 @@ describe('CustomEndpointTransport', () => {
|
||||
expect(fetchSpy).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
||||
it('will drop events if max concurrency is reached', async () => {
|
||||
it('will drop events and log a warning to console if max concurrency is reached', async () => {
|
||||
const calls: Array<(value: unknown) => void> = [];
|
||||
fetchSpy.mockImplementation(
|
||||
() =>
|
||||
|
Loading…
Reference in New Issue
Block a user