Skip to content

Commit

Permalink
[8.x] [ML] Transform: Fix <DefinePivotSummary /> jest test. (#1…
Browse files Browse the repository at this point in the history
…95998) (#203129)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[ML] Transform: Fix <DefinePivotSummary /> jest test.
(#195998)](#195998)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Walter
Rafelsberger","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-12-05T15:59:00Z","message":"[ML]
Transform: Fix <DefinePivotSummary /> jest test. (#195998)\n\n##
Summary\r\n\r\nFixes #195992 (failing test).\r\n\r\nUpdates the mock for
the preview endpoint to make the test pass again.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"c4d64039b3c23433eb643f3a772357407695d024","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":[":ml","release_note:skip","Feature:Transforms","v9.0.0","backport:version","v8.18.0"],"title":"[ML]
Transform: Fix <DefinePivotSummary /> jest
test.","number":195998,"url":"https://github.com/elastic/kibana/pull/195998","mergeCommit":{"message":"[ML]
Transform: Fix <DefinePivotSummary /> jest test. (#195998)\n\n##
Summary\r\n\r\nFixes #195992 (failing test).\r\n\r\nUpdates the mock for
the preview endpoint to make the test pass again.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"c4d64039b3c23433eb643f3a772357407695d024"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/195998","number":195998,"mergeCommit":{"message":"[ML]
Transform: Fix <DefinePivotSummary /> jest test. (#195998)\n\n##
Summary\r\n\r\nFixes #195992 (failing test).\r\n\r\nUpdates the mock for
the preview endpoint to make the test pass again.\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [x] This was
checked for breaking API changes and was
[labeled\r\nappropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#_add_your_labels)","sha":"c4d64039b3c23433eb643f3a772357407695d024"}},{"branch":"8.x","label":"v8.18.0","branchLabelMappingKey":"^v8.18.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Walter Rafelsberger <[email protected]>
  • Loading branch information
kibanamachine and walterra authored Dec 5, 2024
1 parent 67e7073 commit 627d84b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,14 @@ dataStart.search.search = jest.fn(({ params }: IKibanaSearchRequest) => {
}) as ISearchGeneric;

// Replace mock to support tests for `use_index_data`.
coreSetup.http.post = jest.fn().mockResolvedValue([]);
coreSetup.http.post = jest.fn().mockImplementation((endpoint) => {
if (endpoint === '/internal/transform/transforms/_preview') {
return Promise.resolve({
generated_dest_index: { mappings: { properties: {} } },
preview: [],
});
}
});

const appDependencies: AppDependencies = {
analytics: coreStart.analytics,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ import { StepDefineSummary } from './step_define_summary';

jest.mock('../../../../app_dependencies');

// Failing: https://github.com/elastic/kibana/issues/195992
describe.skip('Transform: <DefinePivotSummary />', () => {
// Using the async/await wait()/done() pattern to avoid act() errors.
describe('Transform: <DefinePivotSummary />', () => {
test('Minimal initialization', async () => {
// Arrange
const queryClient = new QueryClient();
Expand Down

0 comments on commit 627d84b

Please sign in to comment.