![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/vendor/swagger-api/swagger-ui/test/unit/docker/ |
const oauthBlockBuilder = require("../../../docker/configurator/oauth") const dedent = require("dedent") describe("docker: env translator - oauth block", function() { it("should omit the block if there are no valid keys", function () { const input = {} expect(oauthBlockBuilder(input)).toEqual(``) }) it("should omit the block if there are no valid keys", function () { const input = { NOT_A_VALID_KEY: "asdf1234" } expect(oauthBlockBuilder(input)).toEqual(``) }) it("should generate a block from empty values", function() { const input = { OAUTH_CLIENT_ID: ``, OAUTH_CLIENT_SECRET: ``, OAUTH_REALM: ``, OAUTH_APP_NAME: ``, OAUTH_SCOPE_SEPARATOR: "", OAUTH_ADDITIONAL_PARAMS: ``, OAUTH_USE_BASIC_AUTH: false, OAUTH_USE_PKCE: false } expect(oauthBlockBuilder(input)).toEqual(dedent(` ui.initOAuth({ clientId: "", clientSecret: "", realm: "", appName: "", scopeSeparator: "", additionalQueryStringParams: undefined, useBasicAuthenticationWithAccessCodeGrant: false, usePkceWithAuthorizationCodeGrant: false, })`)) }) it("should generate a full block", function() { const input = { OAUTH_CLIENT_ID: `myId`, OAUTH_CLIENT_SECRET: `mySecret`, OAUTH_REALM: `myRealm`, OAUTH_APP_NAME: `myAppName`, OAUTH_SCOPE_SEPARATOR: "%21", OAUTH_ADDITIONAL_PARAMS: `{ "a": 1234, "b": "stuff" }`, OAUTH_USE_BASIC_AUTH: true, OAUTH_USE_PKCE: true } expect(oauthBlockBuilder(input)).toEqual(dedent(` ui.initOAuth({ clientId: "myId", clientSecret: "mySecret", realm: "myRealm", appName: "myAppName", scopeSeparator: "%21", additionalQueryStringParams: { "a": 1234, "b": "stuff" }, useBasicAuthenticationWithAccessCodeGrant: true, usePkceWithAuthorizationCodeGrant: true, })`)) }) })