mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Clean up logs and warnings from Edge unit tests (#45050)
* #45026: mock console log output in tests * #45026: update yarn.lock file
This commit is contained in:
@@ -17,6 +17,7 @@ import { mapValues } from 'lodash';
|
||||
import { StreamingFrameAction } from '@grafana/runtime';
|
||||
import { isStreamingResponseData, StreamingResponseData, StreamingResponseDataType } from '../data/utils';
|
||||
import { StreamingDataFrame } from '../data/StreamingDataFrame';
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
|
||||
type SubjectsInsteadOfObservables<T> = {
|
||||
[key in keyof T]: T[key] extends Observable<infer U> ? Subject<U> : T[key];
|
||||
@@ -119,6 +120,16 @@ const dummyErrorMessage = 'dummy-error';
|
||||
describe('LiveDataStream', () => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
let restoreConsole: RestoreConsole | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
restoreConsole = mockConsole();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
restoreConsole?.();
|
||||
});
|
||||
|
||||
const expectValueCollectionState = <T>(
|
||||
valuesCollection: ValuesCollection<T>,
|
||||
state: { errors: number; values: number; complete: boolean }
|
||||
|
||||
@@ -4,8 +4,11 @@ import { Subject } from 'rxjs';
|
||||
import { DataQueryResponse, FieldType, LiveChannelScope } from '@grafana/data';
|
||||
import { StreamingDataFrame } from './data/StreamingDataFrame';
|
||||
import { StreamingResponseDataType } from './data/utils';
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
|
||||
describe('GrafanaLiveService', () => {
|
||||
let restoreConsole: RestoreConsole | undefined;
|
||||
|
||||
const deps = {
|
||||
backendSrv: {},
|
||||
centrifugeSrv: {
|
||||
@@ -25,6 +28,11 @@ describe('GrafanaLiveService', () => {
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
restoreConsole = mockConsole();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
restoreConsole?.();
|
||||
});
|
||||
|
||||
it('should map response from Centrifuge Service to a streaming data frame', async () => {
|
||||
|
||||
Reference in New Issue
Block a user