Co-authored-by: Theo Markovic <theodore.markovic@svenskaspel.se>
This commit is contained in:
@@ -57,7 +57,7 @@ describe("auth plugin - actions", () => {
|
||||
},
|
||||
"http://specs/authorize"
|
||||
],
|
||||
].forEach(([{oas3, server, effectiveServer, scheme, host, url}, expectedFetchUrl]) => {
|
||||
].forEach(([{ oas3, server, effectiveServer, scheme, host, url }, expectedFetchUrl]) => {
|
||||
it("should resolve authorization endpoint against the server URL", () => {
|
||||
|
||||
// Given
|
||||
@@ -72,6 +72,9 @@ describe("auth plugin - actions", () => {
|
||||
authSelectors: {
|
||||
getConfigs: () => ({})
|
||||
},
|
||||
errActions: {
|
||||
newAuthErr: () => ({})
|
||||
},
|
||||
oas3Selectors: {
|
||||
selectedServer: () => server,
|
||||
serverEffectiveValue: () => effectiveServer || server
|
||||
@@ -89,7 +92,7 @@ describe("auth plugin - actions", () => {
|
||||
|
||||
// Then
|
||||
expect(system.fn.fetch.mock.calls.length).toEqual(1)
|
||||
expect(system.fn.fetch.mock.calls[0][0]).toEqual(expect.objectContaining({url: expectedFetchUrl}))
|
||||
expect(system.fn.fetch.mock.calls[0][0]).toEqual(expect.objectContaining({ url: expectedFetchUrl }))
|
||||
})
|
||||
})
|
||||
|
||||
@@ -111,6 +114,9 @@ describe("auth plugin - actions", () => {
|
||||
}
|
||||
})
|
||||
},
|
||||
errActions: {
|
||||
newAuthErr: () => ({})
|
||||
},
|
||||
specSelectors: {
|
||||
isOAS3: () => false,
|
||||
operationScheme: () => "https",
|
||||
@@ -139,6 +145,9 @@ describe("auth plugin - actions", () => {
|
||||
fn: {
|
||||
fetch: jest.fn().mockImplementation(() => Promise.resolve())
|
||||
},
|
||||
errActions: {
|
||||
newAuthErr: () => ({})
|
||||
},
|
||||
getConfigs: () => ({}),
|
||||
authSelectors: {
|
||||
getConfigs: () => ({
|
||||
@@ -167,7 +176,7 @@ describe("auth plugin - actions", () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe("tokenRequest", function() {
|
||||
describe("tokenRequest", function () {
|
||||
it("should send the code verifier when set", () => {
|
||||
const data = {
|
||||
auth: {
|
||||
@@ -203,8 +212,8 @@ describe("auth plugin - actions", () => {
|
||||
const system = {
|
||||
getConfigs: () => ({}),
|
||||
authActions: {
|
||||
authorize: jest.fn(()=>{}),
|
||||
persistAuthorizationIfNeeded: jest.fn(()=>{})
|
||||
authorize: jest.fn(() => { }),
|
||||
persistAuthorizationIfNeeded: jest.fn(() => { })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,8 +235,8 @@ describe("auth plugin - actions", () => {
|
||||
const system = {
|
||||
getConfigs: () => ({}),
|
||||
authActions: {
|
||||
authorizeOauth2: jest.fn(()=>{}),
|
||||
persistAuthorizationIfNeeded: jest.fn(()=>{})
|
||||
authorizeOauth2: jest.fn(() => { }),
|
||||
persistAuthorizationIfNeeded: jest.fn(() => { })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -249,8 +258,8 @@ describe("auth plugin - actions", () => {
|
||||
const system = {
|
||||
getConfigs: () => ({}),
|
||||
authActions: {
|
||||
logout: jest.fn(()=>{}),
|
||||
persistAuthorizationIfNeeded: jest.fn(()=>{})
|
||||
logout: jest.fn(() => { }),
|
||||
persistAuthorizationIfNeeded: jest.fn(() => { })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +284,7 @@ describe("auth plugin - actions", () => {
|
||||
persistAuthorization: false
|
||||
}),
|
||||
authSelectors: {
|
||||
authorized: jest.fn(()=>{})
|
||||
authorized: jest.fn(() => { })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -294,8 +303,11 @@ describe("auth plugin - actions", () => {
|
||||
getConfigs: () => ({
|
||||
persistAuthorization: true
|
||||
}),
|
||||
errActions: {
|
||||
newAuthErr: () => ({})
|
||||
},
|
||||
authSelectors: {
|
||||
authorized: jest.fn(()=>Map(data))
|
||||
authorized: jest.fn(() => Map(data))
|
||||
}
|
||||
}
|
||||
jest.spyOn(Object.getPrototypeOf(window.localStorage), "setItem")
|
||||
|
||||
Reference in New Issue
Block a user