Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

7 лет назад
7 лет назад
7 лет назад
7 лет назад
123456789101112131415161718192021222324252627282930313233343536373839
  1. /* eslint-env mocha */
  2. import expect, { createSpy } from "expect"
  3. import { fromJS } from "immutable"
  4. import win from "core/window"
  5. import oauth2Authorize from "core/oauth2-authorize"
  6. describe("oauth2", function () {
  7. let mockSchema = {
  8. flow: "accessCode",
  9. authorizationUrl: "https://testAuthorizationUrl"
  10. }
  11. let authConfig = {
  12. auth: { schema: { get: (key)=> mockSchema[key] } },
  13. authActions: {},
  14. errActions: {},
  15. configs: { oauth2RedirectUrl: "" },
  16. authConfigs: {}
  17. }
  18. describe("authorize redirect", function () {
  19. it("should build authorize url", function() {
  20. win.open = createSpy()
  21. oauth2Authorize(authConfig)
  22. expect(win.open.calls.length).toEqual(1)
  23. expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?response_type=code&redirect_uri=&state=")
  24. })
  25. it("should append query paramters to authorizeUrl with query parameters", function() {
  26. win.open = createSpy()
  27. mockSchema.authorizationUrl = "https://testAuthorizationUrl?param=1"
  28. oauth2Authorize(authConfig)
  29. expect(win.open.calls.length).toEqual(1)
  30. expect(win.open.calls[0].arguments[0]).toMatch("https://testAuthorizationUrl?param=1&response_type=code&redirect_uri=&state=")
  31. })
  32. })
  33. })