diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-06 18:14:05 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-03-06 18:14:05 +0300 |
commit | 49b16b71778148e9f9c579bf7bf69853c780c827 (patch) | |
tree | 48fe268b98795b8e2af1fa0b40ee5b67b35a4479 /spec/frontend | |
parent | 9ad806210531e19c851a69cbcdaf9ed8bd6cb478 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/authentication/webauthn/util_spec.js | 31 | ||||
-rw-r--r-- | spec/frontend/ci/runner/components/runner_list_empty_state_spec.js | 12 |
2 files changed, 36 insertions, 7 deletions
diff --git a/spec/frontend/authentication/webauthn/util_spec.js b/spec/frontend/authentication/webauthn/util_spec.js index bc44b47d0ba..831d1636b8c 100644 --- a/spec/frontend/authentication/webauthn/util_spec.js +++ b/spec/frontend/authentication/webauthn/util_spec.js @@ -1,4 +1,9 @@ -import { base64ToBuffer, bufferToBase64, base64ToBase64Url } from '~/authentication/webauthn/util'; +import { + base64ToBuffer, + bufferToBase64, + base64ToBase64Url, + supported, +} from '~/authentication/webauthn/util'; const encodedString = 'SGVsbG8gd29ybGQh'; const stringBytes = [72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33]; @@ -31,4 +36,28 @@ describe('Webauthn utils', () => { expect(base64ToBase64Url(argument)).toBe(expectedResult); }); }); + + describe('supported', () => { + afterEach(() => { + global.navigator.credentials = undefined; + window.PublicKeyCredential = undefined; + }); + + it.each` + credentials | PublicKeyCredential | expected + ${undefined} | ${undefined} | ${false} + ${{}} | ${undefined} | ${false} + ${{ create: true }} | ${undefined} | ${false} + ${{ create: true, get: true }} | ${undefined} | ${false} + ${{ create: true, get: true }} | ${true} | ${true} + `( + 'returns $expected when credentials is $credentials and PublicKeyCredential is $PublicKeyCredential', + ({ credentials, PublicKeyCredential, expected }) => { + global.navigator.credentials = credentials; + window.PublicKeyCredential = PublicKeyCredential; + + expect(supported()).toBe(expected); + }, + ); + }); }); diff --git a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js index 9dd6577a166..3e813723b5b 100644 --- a/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js +++ b/spec/frontend/ci/runner/components/runner_list_empty_state_spec.js @@ -62,11 +62,11 @@ describe('RunnerListEmptyState', () => { expect(findEmptyState().text()).toMatchInterpolatedText(`${title} ${desc}`); }); - describe('when create_runner_workflow is enabled', () => { + describe('when create_runner_workflow_for_admin is enabled', () => { beforeEach(() => { createComponent({ provide: { - glFeatures: { createRunnerWorkflow: true }, + glFeatures: { createRunnerWorkflowForAdmin: true }, }, }); }); @@ -76,14 +76,14 @@ describe('RunnerListEmptyState', () => { }); }); - describe('when create_runner_workflow is enabled and newRunnerPath not defined', () => { + describe('when create_runner_workflow_for_admin is enabled and newRunnerPath not defined', () => { beforeEach(() => { createComponent({ props: { newRunnerPath: null, }, provide: { - glFeatures: { createRunnerWorkflow: true }, + glFeatures: { createRunnerWorkflowForAdmin: true }, }, }); }); @@ -95,11 +95,11 @@ describe('RunnerListEmptyState', () => { }); }); - describe('when create_runner_workflow is disabled', () => { + describe('when create_runner_workflow_for_admin is disabled', () => { beforeEach(() => { createComponent({ provide: { - glFeatures: { createRunnerWorkflow: false }, + glFeatures: { createRunnerWorkflowForAdmin: false }, }, }); }); |