Clone role button going to edit page#70768
Conversation
e6647c6 to
892b724
Compare
6113a50 to
5277c50
Compare
💚 Build SucceededBuild metricsSaved Objects .kibana field count
History
To update your PR or re-run it, just comment with: |
|
Pinging @elastic/kibana-security (Team:Security) |
| history = (scopedHistoryMock.create({ | ||
| createHref: jest.fn((location) => location.pathname!), | ||
| }) as unknown) as ScopedHistory; |
There was a problem hiding this comment.
We don't usually add API to override core mock properties, as the same goal can be achieved by using the existing mocked methods.
const history: ScopedHistoryMock = scopedHistoryMock.create()
history.createHref.mockImplementation((location) => location.pathname!));However I see that our ScopedHistoryMock is not compatible with ScopedHistory, which complicates the process a little, see:
const h: ScopedHistory = scopedHistoryMock.create()
Type 'Mocked<Pick<ScopedHistory<unknown>, "replace" | "length" | "push" | "block" | "location" | "action" | "goBack" | "go" | "goForward" | "listen" | "createHref" | "createSubHistory">>' is missing the following properties from type 'ScopedHistory<unknown>': isActive, listeners, locationKeys, currentLocationKeyIndex, and 7 more.@joshdover wdyt? Is this change fine with you, or should we 'fix' the mock instead? I guess that would force us to create a IScopedHistory, but OTOH the mock cannot currently be properly used for testing (appart from using it for jest.mock('src/core/public'))
There was a problem hiding this comment.
I agree we should probably fix the mock and/or create an interface that doesn't require this private properties. Can be done in a follow up PR though if @thomheymann wants to keep this PR focused or have someone Platform do it.
There was a problem hiding this comment.
Ok. I'll create an issue for the mock fix, and revert this change then.
legrego
left a comment
There was a problem hiding this comment.
LGTM pending decision on platform's ScopedHistoryMock. Thanks for the fix!
* Clone role button going to edit page * Added unit tests * Fixed types
|
Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync. |
|
7.x #71218 |
Summary
Fixes #70219
Checklist