mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
# Backport This will backport the following commits from `main` to `8.9`: - [Bump jest@29.6.1 (#161630)](https://github.com/elastic/kibana/pull/161630) <!--- Backport version: 8.9.7 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Patryk Kopyciński","email":"contact@patrykkopycinski.com"},"sourceCommit":{"committedDate":"2023-07-15T15:42:30Z","message":"Bump jest@29.6.1 (#161630)\n\n## Summary\r\n\r\nBump `jest@29.6.1` and resolve duplicated jest-related dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515","branchLabelMapping":{"^v8.10.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","backport:prev-MAJOR","v8.10.0"],"number":161630,"url":"https://github.com/elastic/kibana/pull/161630","mergeCommit":{"message":"Bump jest@29.6.1 (#161630)\n\n## Summary\r\n\r\nBump `jest@29.6.1` and resolve duplicated jest-related dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.10.0","labelRegex":"^v8.10.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/161630","number":161630,"mergeCommit":{"message":"Bump jest@29.6.1 (#161630)\n\n## Summary\r\n\r\nBump `jest@29.6.1` and resolve duplicated jest-related dependencies\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"b2b7cf6253252be011198feda6f04d892cfc5515"}}]}] BACKPORT--> Co-authored-by: Patryk Kopyciński <contact@patrykkopycinski.com>
This commit is contained in:
parent
3277420e0f
commit
d3e1266850
54 changed files with 512 additions and 830 deletions
43
package.json
43
package.json
|
@ -1033,10 +1033,10 @@
|
|||
"@emotion/jest": "^11.11.0",
|
||||
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
||||
"@istanbuljs/schema": "^0.1.2",
|
||||
"@jest/console": "^29.3.1",
|
||||
"@jest/reporters": "^29.3.1",
|
||||
"@jest/transform": "^29.3.1",
|
||||
"@jest/types": "^29.3.1",
|
||||
"@jest/console": "^29.6.1",
|
||||
"@jest/reporters": "^29.6.1",
|
||||
"@jest/transform": "^29.6.1",
|
||||
"@jest/types": "^29.6.1",
|
||||
"@kbn/alerting-api-integration-helpers": "link:x-pack/test/alerting_api_integration/packages/helpers",
|
||||
"@kbn/ambient-common-types": "link:packages/kbn-ambient-common-types",
|
||||
"@kbn/ambient-ftr-types": "link:packages/kbn-ambient-ftr-types",
|
||||
|
@ -1252,13 +1252,13 @@
|
|||
"@types/http-proxy": "^1.17.4",
|
||||
"@types/inquirer": "^7.3.1",
|
||||
"@types/intl-relativeformat": "^2.1.0",
|
||||
"@types/jest": "29.2.0",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/jest-axe": "^3.5.3",
|
||||
"@types/jquery": "^3.3.31",
|
||||
"@types/js-levenshtein": "^1.1.0",
|
||||
"@types/js-search": "^1.4.0",
|
||||
"@types/js-yaml": "^3.11.1",
|
||||
"@types/jsdom": "^16.2.14",
|
||||
"@types/jsdom": "^20.0.1",
|
||||
"@types/json-schema": "^7",
|
||||
"@types/json-stable-stringify": "^1.0.32",
|
||||
"@types/json5": "^2.2.0",
|
||||
|
@ -1331,7 +1331,7 @@
|
|||
"@types/tapable": "^1.0.6",
|
||||
"@types/tar": "^6.1.3",
|
||||
"@types/tempy": "^0.2.0",
|
||||
"@types/testing-library__jest-dom": "^5.14.5",
|
||||
"@types/testing-library__jest-dom": "^5.14.7",
|
||||
"@types/tinycolor2": "^1.4.1",
|
||||
"@types/tough-cookie": "^4.0.2",
|
||||
"@types/type-detect": "^4.0.1",
|
||||
|
@ -1361,7 +1361,7 @@
|
|||
"argsplit": "^1.0.5",
|
||||
"autoprefixer": "^10.4.7",
|
||||
"axe-core": "^4.6.1",
|
||||
"babel-jest": "^29.3.1",
|
||||
"babel-jest": "^29.6.1",
|
||||
"babel-loader": "^8.2.5",
|
||||
"babel-plugin-add-module-exports": "^1.0.4",
|
||||
"babel-plugin-istanbul": "^6.1.1",
|
||||
|
@ -1416,7 +1416,7 @@
|
|||
"eslint-plugin-react-perf": "^3.3.0",
|
||||
"eslint-traverse": "^1.0.0",
|
||||
"exit-hook": "^2.2.0",
|
||||
"expect": "^29.3.1",
|
||||
"expect": "^29.6.1",
|
||||
"expose-loader": "^0.7.5",
|
||||
"faker": "^5.1.0",
|
||||
"fetch-mock": "^7.3.9",
|
||||
|
@ -1435,21 +1435,20 @@
|
|||
"html-loader": "^1.3.2",
|
||||
"http-proxy": "^1.18.1",
|
||||
"is-path-inside": "^3.0.2",
|
||||
"jest": "^29.3.1",
|
||||
"jest": "^29.6.1",
|
||||
"jest-axe": "^5.0.0",
|
||||
"jest-canvas-mock": "^2.4.0",
|
||||
"jest-cli": "^29.3.1",
|
||||
"jest-config": "^29.3.1",
|
||||
"jest-diff": "^29.3.1",
|
||||
"jest-environment-jsdom": "^29.3.1",
|
||||
"jest-matcher-utils": "^29.3.1",
|
||||
"jest-mock": "^29.3.1",
|
||||
"jest-runtime": "^29.3.1",
|
||||
"jest-silent-reporter": "^0.5.0",
|
||||
"jest-snapshot": "^29.3.1",
|
||||
"jest-specific-snapshot": "^5.0.0",
|
||||
"jest-canvas-mock": "^2.5.2",
|
||||
"jest-cli": "^29.6.1",
|
||||
"jest-config": "^29.6.1",
|
||||
"jest-diff": "^29.6.1",
|
||||
"jest-environment-jsdom": "^29.6.1",
|
||||
"jest-matcher-utils": "^29.6.1",
|
||||
"jest-mock": "^29.6.1",
|
||||
"jest-runtime": "^29.6.1",
|
||||
"jest-snapshot": "^29.6.1",
|
||||
"jest-specific-snapshot": "^8.0.0",
|
||||
"jest-styled-components": "7.0.3",
|
||||
"jsdom": "^16.4.0",
|
||||
"jsdom": "^20.0.1",
|
||||
"json-schema-typed": "^8.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"jsondiffpatch": "0.4.1",
|
||||
|
|
|
@ -1145,7 +1145,7 @@ describe('#start()', () => {
|
|||
removeListenerSpy = jest.spyOn(window, 'removeEventListener');
|
||||
});
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('calls `navigateToApp` with `skipAppLeave` option', async () => {
|
||||
|
@ -1232,7 +1232,7 @@ describe('#stop()', () => {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('removes the beforeunload listener', async () => {
|
||||
|
|
|
@ -27,7 +27,7 @@ beforeEach(() => {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
mockCreateWriteStream.mockClear();
|
||||
mockStreamWrite.mockClear();
|
||||
mockGetFlattenedObject.mockClear();
|
||||
|
|
|
@ -25,7 +25,7 @@ describe('OsMetricsCollector', () => {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('collects platform info from the os package', async () => {
|
||||
|
|
|
@ -217,7 +217,7 @@ describe('plugins discovery system', () => {
|
|||
afterEach(() => {
|
||||
mockFs.restore();
|
||||
// restore the console.log behavior
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
it('discovers plugins in the search locations', async () => {
|
||||
|
|
|
@ -29,7 +29,7 @@ beforeEach(() => {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
logger.asLoggerFactory.mockClear();
|
||||
logger.stop.mockClear();
|
||||
rawConfigService.getConfig$.mockClear();
|
||||
|
|
|
@ -96,6 +96,6 @@ describe('Kibana keystore: show', () => {
|
|||
afterEach(() => {
|
||||
mockLogFn.mockReset();
|
||||
mockErrFn.mockReset();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -52,7 +52,7 @@ describe('AggConfig', () => {
|
|||
];
|
||||
|
||||
beforeEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
indexPattern = {
|
||||
id: '1234',
|
||||
title: 'logstash-*',
|
||||
|
@ -314,6 +314,7 @@ describe('AggConfig', () => {
|
|||
objs.forEach((obj, i) => {
|
||||
expect(obj).toHaveProperty('id', String(start + i));
|
||||
});
|
||||
spy.mockRestore();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ const inMemoryMetrics = inMemoryMetricsMock.create();
|
|||
const alertsService = alertsServiceMock.create();
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
mockedLicenseState = licenseStateMock.create();
|
||||
ruleTypeRegistryParams = {
|
||||
logger,
|
||||
|
@ -96,16 +96,18 @@ describe('Create Lifecycle', () => {
|
|||
|
||||
const invalidCharacters = [' ', ':', '*', '*', '/'];
|
||||
for (const char of invalidCharacters) {
|
||||
expect(() => registry.register({ ...ruleType, id: `${ruleType.id}${char}` })).toThrowError(
|
||||
new Error(`expected RuleType Id not to include invalid character: ${char}`)
|
||||
expect(() =>
|
||||
registry.register({ ...ruleType, id: `${ruleType.id}${char}` })
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected RuleType Id not to include invalid character: ${char}"`
|
||||
);
|
||||
}
|
||||
|
||||
const [first, second] = invalidCharacters;
|
||||
expect(() =>
|
||||
registry.register({ ...ruleType, id: `${first}${ruleType.id}${second}` })
|
||||
).toThrowError(
|
||||
new Error(`expected RuleType Id not to include invalid characters: ${first}, ${second}`)
|
||||
).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected RuleType Id not to include invalid characters: ${first}, ${second}"`
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -130,8 +132,8 @@ describe('Create Lifecycle', () => {
|
|||
};
|
||||
const registry = new RuleTypeRegistry(ruleTypeRegistryParams);
|
||||
|
||||
expect(() => registry.register(ruleType)).toThrowError(
|
||||
new Error(`expected value of type [string] but got [number]`)
|
||||
expect(() => registry.register(ruleType)).toThrowErrorMatchingInlineSnapshot(
|
||||
`"expected value of type [string] but got [number]"`
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
@ -19,7 +19,6 @@ describe('useActionTypes', () => {
|
|||
let appMockRenderer: AppMockRenderer;
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
appMockRenderer = createAppMockRenderer();
|
||||
});
|
||||
|
||||
|
|
|
@ -40,7 +40,6 @@ describe('UseFindCaseUserActions', () => {
|
|||
beforeEach(() => {
|
||||
appMockRender = createAppMockRenderer();
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('returns proper state on findCaseUserActions', async () => {
|
||||
|
|
|
@ -20,7 +20,6 @@ describe('useGetActionLicense', () => {
|
|||
let appMockRenderer: AppMockRenderer;
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
appMockRenderer = createAppMockRenderer();
|
||||
});
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ describe('useGetCaseMetrics', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('calls getSingleCaseMetrics with correct arguments', async () => {
|
||||
|
|
|
@ -20,7 +20,6 @@ describe('useGetCategories', () => {
|
|||
const abortCtrl = new AbortController();
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('calls getCategories api', async () => {
|
||||
|
|
|
@ -20,7 +20,6 @@ describe('useGetTags', () => {
|
|||
const abortCtrl = new AbortController();
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('calls getTags api', async () => {
|
||||
|
|
|
@ -39,7 +39,6 @@ describe('UseInfiniteFindCaseUserActions', () => {
|
|||
beforeEach(() => {
|
||||
appMockRender = createAppMockRenderer();
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('returns proper state on findCaseUserActions', async () => {
|
||||
|
@ -138,6 +137,7 @@ describe('UseInfiniteFindCaseUserActions', () => {
|
|||
expect.any(AbortSignal)
|
||||
);
|
||||
expect(addError).toHaveBeenCalled();
|
||||
spy.mockRestore();
|
||||
});
|
||||
|
||||
it('fetches next page with correct params', async () => {
|
||||
|
|
|
@ -43,7 +43,7 @@ jest.mock('../../common/navigation/use_csp_integration_link');
|
|||
const chance = new Chance();
|
||||
|
||||
beforeEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
(useSubscriptionStatus as jest.Mock).mockImplementation(() =>
|
||||
createReactQueryResponse({
|
||||
|
|
|
@ -156,10 +156,12 @@ services.alertFactory.create.mockImplementation((instanceID: string) => {
|
|||
: newAlertInstance;
|
||||
alertInstances.set(instanceID, alertInstance);
|
||||
|
||||
alertInstance.instance.scheduleActions.mockImplementation((id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
});
|
||||
(alertInstance.instance.scheduleActions as jest.Mock).mockImplementation(
|
||||
(id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
}
|
||||
);
|
||||
|
||||
return alertInstance.instance;
|
||||
});
|
||||
|
|
|
@ -1961,10 +1961,12 @@ services.alertFactory.create.mockImplementation((instanceID: string) => {
|
|||
alertInstance.state = newState;
|
||||
return alertInstance.instance;
|
||||
});
|
||||
alertInstance.instance.scheduleActions.mockImplementation((id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
});
|
||||
(alertInstance.instance.scheduleActions as jest.Mock).mockImplementation(
|
||||
(id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
}
|
||||
);
|
||||
return alertInstance.instance;
|
||||
});
|
||||
|
||||
|
|
|
@ -1934,10 +1934,12 @@ services.alertFactory.create.mockImplementation((instanceID: string) => {
|
|||
alertInstance.state = newState;
|
||||
return alertInstance.instance;
|
||||
});
|
||||
alertInstance.instance.scheduleActions.mockImplementation((id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
});
|
||||
(alertInstance.instance.scheduleActions as jest.Mock).mockImplementation(
|
||||
(id: string, action: any) => {
|
||||
alertInstance.actionQueue.push({ id, action });
|
||||
return alertInstance.instance;
|
||||
}
|
||||
);
|
||||
return alertInstance.instance;
|
||||
});
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ describe(`GET ${API_GET_ILM_POLICY_STATUS}`, () => {
|
|||
});
|
||||
|
||||
afterEach(async () => {
|
||||
jest.restoreAllMocks();
|
||||
await server.stop();
|
||||
});
|
||||
|
||||
|
|
|
@ -70,7 +70,6 @@ describe('POST /diagnose/browser', () => {
|
|||
});
|
||||
|
||||
afterEach(async () => {
|
||||
jest.restoreAllMocks();
|
||||
await server.stop();
|
||||
});
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ describe('SessionManagementService', () => {
|
|||
});
|
||||
|
||||
afterEach(() => {
|
||||
mockSessionIndexInitialize.mockReset();
|
||||
mockSessionIndexCleanUp.mockReset();
|
||||
mockSessionIndexInitialize.mockClear();
|
||||
mockSessionIndexCleanUp.mockClear();
|
||||
});
|
||||
|
||||
describe('setup()', () => {
|
||||
|
|
|
@ -100,10 +100,6 @@ describe('Sourcerer component', () => {
|
|||
(useSignalHelpers as jest.Mock).mockReturnValue({ signalIndexNeedsInit: false });
|
||||
});
|
||||
|
||||
afterAll(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('renders data view title', () => {
|
||||
const wrapper = mount(
|
||||
<TestProviders store={store}>
|
||||
|
@ -896,8 +892,8 @@ describe('Sourcerer integration tests', () => {
|
|||
(useSourcererDataView as jest.Mock).mockReturnValue(sourcererDataView);
|
||||
store = createStore(state, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('Selects a different index pattern', async () => {
|
||||
const wrapper = mount(
|
||||
<TestProviders store={store}>
|
||||
|
@ -941,8 +937,8 @@ describe('No data', () => {
|
|||
});
|
||||
store = createStore(mockNoIndicesState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('Hide sourcerer - default ', () => {
|
||||
const wrapper = mount(
|
||||
<TestProviders store={store}>
|
||||
|
|
|
@ -160,7 +160,6 @@ describe('Sourcerer Hooks', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
store = createStore(mockGlobalState, SUB_PLUGINS_REDUCER, kibanaObservable, storage);
|
||||
mockUseUserInfo.mockImplementation(() => userInfoState);
|
||||
});
|
||||
|
|
|
@ -144,7 +144,6 @@ describe('When the add exception modal is opened', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('when the modal is loading', () => {
|
||||
|
|
|
@ -160,7 +160,6 @@ describe('When the edit exception modal is opened', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('when the modal is loading', () => {
|
||||
|
|
|
@ -109,7 +109,6 @@ describe.skip('useFetchOrCreateRuleExceptionList', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('initializes hook', async () => {
|
||||
|
|
|
@ -31,7 +31,6 @@ describe('Alert by type chart', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('isAlertTypeEnabled flag is true', () => {
|
||||
|
|
|
@ -24,7 +24,6 @@ describe('Alert by type panel', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('renders correctly', async () => {
|
||||
|
|
|
@ -27,7 +27,6 @@ describe('Alert by grouping', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('progress bars renders correctly', () => {
|
||||
|
|
|
@ -38,7 +38,6 @@ describe('Alert by grouping', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('renders correctly', async () => {
|
||||
|
|
|
@ -24,7 +24,6 @@ describe('Severity level panel', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('renders correctly', async () => {
|
||||
|
|
|
@ -25,7 +25,6 @@ describe('Severity level chart', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('renders severity table correctly', () => {
|
||||
|
|
|
@ -266,7 +266,6 @@ describe('alert actions', () => {
|
|||
// spyOn. So now we're doing all three of these.
|
||||
// https://github.com/facebook/jest/issues/7136#issuecomment-565976599
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
mockGetExceptionFilter = jest.fn().mockResolvedValue(undefined);
|
||||
|
||||
|
|
|
@ -22,9 +22,6 @@ describe('useCasesFromAlerts hook', () => {
|
|||
appToastsMock = useAppToastsMock.create();
|
||||
(useAppToasts as jest.Mock).mockReturnValue(appToastsMock);
|
||||
});
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('returns an array of caseIds', async () => {
|
||||
const spyOnCases = jest.spyOn(api, 'getCaseIdsFromAlertId');
|
||||
|
|
|
@ -35,7 +35,6 @@ describe('ChartCollapse', () => {
|
|||
|
||||
afterEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('it renders the chart collapse panel and the 3 summary componenets', () => {
|
||||
|
|
|
@ -19,7 +19,6 @@ jest.mock('../../../../../common/hooks/use_experimental_features');
|
|||
describe('ChartSelect', () => {
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('it renders the chart select button when alertsPageChartsEnabled is false', () => {
|
||||
|
|
|
@ -84,7 +84,6 @@ describe('ExceptionsListCard', () => {
|
|||
});
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should display expired exception confirmation modal when "showIncludeExpiredExceptionsModal" is "true"', () => {
|
||||
|
|
|
@ -28,7 +28,6 @@ export class TestError extends Error {
|
|||
describe('read_rules', () => {
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
describe('readRules', () => {
|
||||
|
|
|
@ -58,7 +58,6 @@ describe('get_export_by_object_ids', () => {
|
|||
const actionsClient = actionsClientMock.create();
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
clients.savedObjectsClient.find.mockResolvedValue(getEmptySavedObjectsResponse());
|
||||
|
|
|
@ -83,7 +83,6 @@ describe('utils', () => {
|
|||
clock.restore();
|
||||
jest.clearAllMocks();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
describe('generateId', () => {
|
||||
|
|
|
@ -35,7 +35,6 @@ describe('clean draft timelines', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
|
|
@ -34,7 +34,6 @@ describe('get draft timelines', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
|
|
@ -45,7 +45,6 @@ describe('create timelines', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
|
|
@ -53,7 +53,6 @@ describe('import timelines', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
@ -514,7 +513,6 @@ describe('import timeline templates', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
|
|
@ -42,7 +42,6 @@ describe('update timelines', () => {
|
|||
beforeEach(() => {
|
||||
jest.resetModules();
|
||||
jest.resetAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
jest.clearAllMocks();
|
||||
|
||||
server = serverMock.create();
|
||||
|
|
|
@ -23,7 +23,7 @@ const alertFactory = (contextKeys: unknown[], testAlertActionArr: unknown[]) =>
|
|||
GeoContainmentAlertInstanceState,
|
||||
GeoContainmentAlertInstanceContext
|
||||
>();
|
||||
alertInstance.scheduleActions.mockImplementation(
|
||||
(alertInstance.scheduleActions as jest.Mock).mockImplementation(
|
||||
(actionGroupId: string, context?: GeoContainmentAlertInstanceContext) => {
|
||||
// Check subset of alert for comparison to expected results
|
||||
// @ts-ignore
|
||||
|
|
|
@ -20,7 +20,7 @@ const alertFactory = (contextKeys: unknown[], testAlertActionArr: unknown[]) =>
|
|||
GeoContainmentAlertInstanceState,
|
||||
GeoContainmentAlertInstanceContext
|
||||
>();
|
||||
alertInstance.scheduleActions.mockImplementation(
|
||||
(alertInstance.scheduleActions as jest.Mock).mockImplementation(
|
||||
(actionGroupId: string, context?: GeoContainmentAlertInstanceContext) => {
|
||||
// Check subset of alert for comparison to expected results
|
||||
// @ts-ignore
|
||||
|
|
|
@ -40,7 +40,6 @@ describe('useGetApplication', () => {
|
|||
|
||||
beforeEach(() => {
|
||||
jest.clearAllMocks();
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('init', async () => {
|
||||
|
|
|
@ -109,8 +109,6 @@ describe('checkAccountAccessStatus', () => {
|
|||
(axios as jest.MockedFunction<typeof axios>).mockReset();
|
||||
});
|
||||
|
||||
afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
it('includes a header with the kibana version', async () => {
|
||||
const apiClient = new ServiceAPIClient(
|
||||
jest.fn() as unknown as Logger,
|
||||
|
@ -151,8 +149,6 @@ describe('callAPI', () => {
|
|||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
const logger = loggerMock.create();
|
||||
|
||||
const config = {
|
||||
|
|
|
@ -144,8 +144,6 @@ describe('SyntheticsService', () => {
|
|||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
afterEach(() => jest.restoreAllMocks());
|
||||
|
||||
it('setup properly', async () => {
|
||||
const service = new SyntheticsService(serverMock);
|
||||
service.setup(taskManagerSetup);
|
||||
|
|
|
@ -57,15 +57,12 @@ describe('RuleStatusDropdown', () => {
|
|||
};
|
||||
|
||||
beforeEach(() => {
|
||||
jest.resetAllMocks();
|
||||
jest.clearAllMocks();
|
||||
});
|
||||
|
||||
beforeAll(() => {
|
||||
jest.spyOn(global.Date, 'now').mockImplementation(() => new Date(NOW_STRING).valueOf());
|
||||
});
|
||||
afterAll(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
test('renders status control', () => {
|
||||
const wrapper = mountWithIntl(<RuleStatusDropdown {...props} />);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue