mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Remove dependency jest-mock-console (#52872)
* Update dependency jest-mock-console to v2 * let's remove jest-mock-console Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
This commit is contained in:
parent
1da4aa25a8
commit
013dda7bb8
@ -209,7 +209,6 @@
|
||||
"jest-fail-on-console": "2.4.2",
|
||||
"jest-junit": "14.0.0",
|
||||
"jest-matcher-utils": "28.1.3",
|
||||
"jest-mock-console": "1.2.3",
|
||||
"lerna": "5.2.0",
|
||||
"lint-staged": "13.0.3",
|
||||
"mini-css-extract-plugin": "2.6.1",
|
||||
|
@ -1,4 +1,3 @@
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
import { mapValues } from 'lodash';
|
||||
import { Observable, Subject, Subscription, Unsubscribable } from 'rxjs';
|
||||
|
||||
@ -123,14 +122,12 @@ const dummyErrorMessage = 'dummy-error';
|
||||
describe('LiveDataStream', () => {
|
||||
jest.useFakeTimers();
|
||||
|
||||
let restoreConsole: RestoreConsole | undefined;
|
||||
|
||||
beforeEach(() => {
|
||||
restoreConsole = mockConsole();
|
||||
jest.spyOn(console, 'log').mockImplementation(jest.fn);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
restoreConsole?.();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
const expectValueCollectionState = <T>(
|
||||
|
@ -1,4 +1,3 @@
|
||||
import mockConsole, { RestoreConsole } from 'jest-mock-console';
|
||||
import { Subject } from 'rxjs';
|
||||
|
||||
import { DataQueryResponse, FieldType, LiveChannelScope } from '@grafana/data';
|
||||
@ -9,8 +8,6 @@ import { StreamingResponseDataType } from './data/utils';
|
||||
import { GrafanaLiveService } from './live';
|
||||
|
||||
describe('GrafanaLiveService', () => {
|
||||
let restoreConsole: RestoreConsole | undefined;
|
||||
|
||||
const deps = {
|
||||
backendSrv: {},
|
||||
centrifugeSrv: {
|
||||
@ -28,13 +25,8 @@ describe('GrafanaLiveService', () => {
|
||||
},
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
restoreConsole = mockConsole();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
restoreConsole?.();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('should map response from Centrifuge Service to a streaming data frame', async () => {
|
||||
@ -129,6 +121,7 @@ describe('GrafanaLiveService', () => {
|
||||
});
|
||||
|
||||
it('should return an empty frame if first message was not a full frame', async () => {
|
||||
jest.spyOn(console, 'warn').mockImplementation(jest.fn);
|
||||
const dummySubject = new Subject<StreamingDataQueryResponse>();
|
||||
deps.centrifugeSrv.getDataStream.mockReturnValueOnce(dummySubject);
|
||||
|
||||
@ -154,5 +147,6 @@ describe('GrafanaLiveService', () => {
|
||||
const frame: StreamingDataFrame = response?.data[0];
|
||||
expect(frame).toBeInstanceOf(StreamingDataFrame);
|
||||
expect(frame.fields).toEqual([]);
|
||||
expect(console.warn).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
10
yarn.lock
10
yarn.lock
@ -21858,7 +21858,6 @@ __metadata:
|
||||
jest-fail-on-console: 2.4.2
|
||||
jest-junit: 14.0.0
|
||||
jest-matcher-utils: 28.1.3
|
||||
jest-mock-console: 1.2.3
|
||||
jquery: 3.6.0
|
||||
js-yaml: ^4.1.0
|
||||
json-source-map: 0.6.1
|
||||
@ -24723,15 +24722,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest-mock-console@npm:1.2.3":
|
||||
version: 1.2.3
|
||||
resolution: "jest-mock-console@npm:1.2.3"
|
||||
peerDependencies:
|
||||
jest: ">= 22.4.2"
|
||||
checksum: 16f449e309919309b87b6ffb7171ff1feccb628bac97c44aa59594951447833abaaac4957be4258e1c7ce3c54ef6e24cb1e2a7c310f7b8cbc6b598323819dc10
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"jest-mock@npm:^27.5.1":
|
||||
version: 27.5.1
|
||||
resolution: "jest-mock@npm:27.5.1"
|
||||
|
Loading…
Reference in New Issue
Block a user