-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I'll create an issue for the mock fix, and revert this change then.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created #71166
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending decision on platform's ScopedHistoryMock
. Thanks for the fix!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* 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. |
* Clone role button going to edit page * Added unit tests * Fixed types Co-authored-by: Elastic Machine <[email protected]>
7.x #71218 |
Summary
Fixes #70219
Checklist