feat(oauth2): authActions.authPopup plugin accessible wrapper (#7699)
* enables win.open to be extensible by plugins Co-authored-by: Tim Lai <timothy.lai@gmail.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { Map } from "immutable"
|
||||
import win from "core/window"
|
||||
import {
|
||||
authorizeRequest,
|
||||
authorizeAccessCodeWithFormParams,
|
||||
@@ -7,7 +8,7 @@ import {
|
||||
logoutWithPersistOption,
|
||||
persistAuthorizationIfNeeded
|
||||
} from "corePlugins/auth/actions"
|
||||
import { authorizeAccessCodeWithBasicAuthentication } from "../../../../../src/core/plugins/auth/actions"
|
||||
import {authorizeAccessCodeWithBasicAuthentication, authPopup} from "../../../../../src/core/plugins/auth/actions"
|
||||
|
||||
describe("auth plugin - actions", () => {
|
||||
|
||||
@@ -327,5 +328,19 @@ describe("auth plugin - actions", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("authPopup", () => {
|
||||
beforeEach(() => {
|
||||
win.open = jest.fn()
|
||||
})
|
||||
it("should call win.open with url", () => {
|
||||
const windowOpenSpy = jest.spyOn(win, "open")
|
||||
|
||||
authPopup("http://swagger.ui", {})()
|
||||
|
||||
expect(windowOpenSpy.mock.calls.length).toEqual(1)
|
||||
windowOpenSpy.mockReset()
|
||||
})
|
||||
})
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user