Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/frontend/ide/init_gitlab_web_ide_spec.js')
-rw-r--r--spec/frontend/ide/init_gitlab_web_ide_spec.js28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/frontend/ide/init_gitlab_web_ide_spec.js b/spec/frontend/ide/init_gitlab_web_ide_spec.js
index 6a5bedb0bbb..d7a16bec1c3 100644
--- a/spec/frontend/ide/init_gitlab_web_ide_spec.js
+++ b/spec/frontend/ide/init_gitlab_web_ide_spec.js
@@ -40,6 +40,9 @@ const TEST_EDITOR_FONT_SRC_URL = 'http://gitlab.test/assets/gitlab-mono/GitLabMo
const TEST_EDITOR_FONT_FORMAT = 'woff2';
const TEST_EDITOR_FONT_FAMILY = 'GitLab Mono';
+const TEST_OAUTH_CLIENT_ID = 'oauth-client-id-123abc';
+const TEST_OAUTH_CALLBACK_URL = 'https://example.com/oauth_callback';
+
describe('ide/init_gitlab_web_ide', () => {
let resolveConfirm;
@@ -231,4 +234,29 @@ describe('ide/init_gitlab_web_ide', () => {
);
});
});
+
+ describe('when oauth info is in dataset', () => {
+ beforeEach(() => {
+ findRootElement().dataset.clientId = TEST_OAUTH_CLIENT_ID;
+ findRootElement().dataset.callbackUrl = TEST_OAUTH_CALLBACK_URL;
+
+ createSubject();
+ });
+
+ it('calls start with element', () => {
+ expect(start).toHaveBeenCalledTimes(1);
+ expect(start).toHaveBeenCalledWith(
+ findRootElement(),
+ expect.objectContaining({
+ auth: {
+ type: 'oauth',
+ clientId: TEST_OAUTH_CLIENT_ID,
+ callbackUrl: TEST_OAUTH_CALLBACK_URL,
+ protectRefreshToken: true,
+ },
+ httpHeaders: undefined,
+ }),
+ );
+ });
+ });
});