-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Graph] Switch to SavedObjectClient.resolve (#109617)
- Loading branch information
Showing
11 changed files
with
325 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/graph/public/components/workspace_layout/workspace_layout.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import { WorkspaceLayoutComponent } from '.'; | ||
import { coreMock } from 'src/core/public/mocks'; | ||
import { spacesPluginMock } from '../../../../spaces/public/mocks'; | ||
import { NavigationPublicPluginStart as NavigationStart } from '../../../../../../src/plugins/navigation/public'; | ||
import { GraphSavePolicy, GraphWorkspaceSavedObject, IndexPatternProvider } from '../../types'; | ||
import { OverlayStart, Capabilities } from 'kibana/public'; | ||
import { SharingSavedObjectProps } from '../../helpers/use_workspace_loader'; | ||
|
||
jest.mock('react-router-dom', () => { | ||
const useLocation = () => ({ | ||
search: '?query={}', | ||
}); | ||
return { | ||
useLocation, | ||
}; | ||
}); | ||
|
||
describe('workspace_layout', () => { | ||
const defaultProps = { | ||
renderCounter: 1, | ||
loading: false, | ||
savedWorkspace: { id: 'test' } as GraphWorkspaceSavedObject, | ||
hasFields: true, | ||
overlays: {} as OverlayStart, | ||
workspaceInitialized: true, | ||
indexPatterns: [], | ||
indexPatternProvider: {} as IndexPatternProvider, | ||
capabilities: {} as Capabilities, | ||
coreStart: coreMock.createStart(), | ||
graphSavePolicy: 'configAndDataWithConsent' as GraphSavePolicy, | ||
navigation: {} as NavigationStart, | ||
canEditDrillDownUrls: true, | ||
setHeaderActionMenu: jest.fn(), | ||
sharingSavedObjectProps: { | ||
outcome: 'exactMatch', | ||
aliasTargetId: '', | ||
} as SharingSavedObjectProps, | ||
spaces: spacesPluginMock.createStartContract(), | ||
}; | ||
it('should display conflict notification if outcome is conflict', () => { | ||
shallow( | ||
<WorkspaceLayoutComponent | ||
{...defaultProps} | ||
sharingSavedObjectProps={{ outcome: 'conflict', aliasTargetId: 'conflictId' }} | ||
/> | ||
); | ||
expect(defaultProps.spaces.ui.components.getLegacyUrlConflict).toHaveBeenCalledWith({ | ||
currentObjectId: 'test', | ||
objectNoun: 'Graph', | ||
otherObjectId: 'conflictId', | ||
otherObjectPath: '#/workspace/conflictId?query={}', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.