satisfy project lint rules

This commit is contained in:
AlexVangelov
2017-09-15 20:52:55 -04:00
parent 9b1a6141df
commit 4172e33e04
2 changed files with 19 additions and 19 deletions

View File

@@ -64,8 +64,8 @@ export default function authorize ( { auth, authActions, errActions, configs, au
} }
} }
let authorizationUrl = schema.get("authorizationUrl"); let authorizationUrl = schema.get("authorizationUrl")
let url = [authorizationUrl, query.join("&")].join(authorizationUrl.indexOf('?') === -1 ? "?" : "&") let url = [authorizationUrl, query.join("&")].join(authorizationUrl.indexOf("?") === -1 ? "?" : "&")
// pass action authorizeOauth2 and authentication data through window // pass action authorizeOauth2 and authentication data through window
// to authorize with oauth2 // to authorize with oauth2

View File

@@ -7,9 +7,9 @@ import oauth2Authorize from "core/oauth2-authorize"
describe("OAuth2", function () { describe("OAuth2", function () {
let mockSchema = { let mockSchema = {
flow: 'accessCode', flow: "accessCode",
authorizationUrl: 'https://testAuthorizationUrl' authorizationUrl: "https://testAuthorizationUrl"
}; }
let authConfig = { let authConfig = {
auth: { schema: { get: (key)=> mockSchema[key] } }, auth: { schema: { get: (key)=> mockSchema[key] } },
@@ -17,23 +17,23 @@ describe("OAuth2", function () {
errActions: {}, errActions: {},
configs: { oauth2RedirectUrl: "" }, configs: { oauth2RedirectUrl: "" },
authConfigs: {} authConfigs: {}
}; }
describe("authorize redirect", function () { describe("authorize redirect", function () {
it("should build redirectUrl", function() { it("should build redirectUrl", function() {
win.open = createSpy(); win.open = createSpy()
oauth2Authorize(authConfig); oauth2Authorize(authConfig)
expect(win.open.calls.length).toEqual(1); expect(win.open.calls.length).toEqual(1)
expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?response_type=code&redirect_uri=&state="); expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?response_type=code&redirect_uri=&state=")
}); })
it("should build correct redirectUrl from authorizeUrl with query parameters", function() { it("should build correct redirectUrl from authorizeUrl with query parameters", function() {
win.open = createSpy(); win.open = createSpy()
mockSchema.authorizationUrl = 'https://testAuthorizationUrl?param=1'; mockSchema.authorizationUrl = "https://testAuthorizationUrl?param=1"
oauth2Authorize(authConfig); oauth2Authorize(authConfig)
expect(win.open.calls.length).toEqual(1); expect(win.open.calls.length).toEqual(1)
expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?param=1&response_type=code&redirect_uri=&state="); expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?param=1&response_type=code&redirect_uri=&state=")
}); })
}); })
}); })