tests: extract mocks into separate module

This commit is contained in:
Alexander Zobnin
2018-11-15 10:13:49 +03:00
parent 815f6cc801
commit 2b44a40c55
3 changed files with 45 additions and 26 deletions

26
src/test-setup/mocks.js Normal file
View File

@@ -0,0 +1,26 @@
export let templateSrvMock = {
replace: jest.fn().mockImplementation(query => query)
};
export let backendSrvMock = {
datasourceRequest: jest.fn()
};
export let datasourceSrvMock = {
loadDatasource: jest.fn(),
getAll: jest.fn()
};
export let zabbixAlertingSrvMock = {
setPanelAlertState: jest.fn(),
removeZabbixThreshold: jest.fn(),
};
const defaultExports = {
templateSrvMock,
backendSrvMock,
datasourceSrvMock,
zabbixAlertingSrvMock
};
export default defaultExports;