diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-14 18:11:29 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-11-14 18:11:29 +0300 |
commit | 2d80ade70258fa78e9ada2e8b3055129a69654f3 (patch) | |
tree | a23e474b4cc5184db445a6121f9eb75c0653fe5f /spec/frontend/token_access | |
parent | 61a82b8ec062d6f122dadd38783c7754cef7ce2b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/token_access')
-rw-r--r-- | spec/frontend/token_access/mock_data.js | 12 | ||||
-rw-r--r-- | spec/frontend/token_access/token_access_spec.js | 7 | ||||
-rw-r--r-- | spec/frontend/token_access/token_projects_table_spec.js | 13 |
3 files changed, 26 insertions, 6 deletions
diff --git a/spec/frontend/token_access/mock_data.js b/spec/frontend/token_access/mock_data.js index 6e2908e659f..2eed1e30d0d 100644 --- a/spec/frontend/token_access/mock_data.js +++ b/spec/frontend/token_access/mock_data.js @@ -38,6 +38,10 @@ export const projectsWithScope = { id: '2', fullPath: 'root/332268-test', name: 'root/332268-test', + namespace: { + id: '1234', + fullPath: 'root', + }, }, ], }, @@ -68,6 +72,10 @@ export const mockProjects = [ { id: '1', name: 'merge-train-stuff', + namespace: { + id: '1235', + fullPath: 'root', + }, fullPath: 'root/merge-train-stuff', isLocked: false, __typename: 'Project', @@ -75,6 +83,10 @@ export const mockProjects = [ { id: '2', name: 'ci-project', + namespace: { + id: '1236', + fullPath: 'root', + }, fullPath: 'root/ci-project', isLocked: true, __typename: 'Project', diff --git a/spec/frontend/token_access/token_access_spec.js b/spec/frontend/token_access/token_access_spec.js index c55ac32b6a6..ea1d9db515a 100644 --- a/spec/frontend/token_access/token_access_spec.js +++ b/spec/frontend/token_access/token_access_spec.js @@ -19,7 +19,8 @@ import { } from './mock_data'; const projectPath = 'root/my-repo'; -const error = new Error('Error'); +const message = 'An error occurred'; +const error = new Error(message); Vue.use(VueApollo); @@ -144,7 +145,7 @@ describe('TokenAccess component', () => { await waitForPromises(); - expect(createAlert).toHaveBeenCalled(); + expect(createAlert).toHaveBeenCalledWith({ message }); }); }); @@ -187,7 +188,7 @@ describe('TokenAccess component', () => { await waitForPromises(); - expect(createAlert).toHaveBeenCalled(); + expect(createAlert).toHaveBeenCalledWith({ message }); }); }); }); diff --git a/spec/frontend/token_access/token_projects_table_spec.js b/spec/frontend/token_access/token_projects_table_spec.js index 3bda0d0b530..0fa1a2453f7 100644 --- a/spec/frontend/token_access/token_projects_table_spec.js +++ b/spec/frontend/token_access/token_projects_table_spec.js @@ -1,5 +1,5 @@ import { GlTable, GlButton } from '@gitlab/ui'; -import { mount } from '@vue/test-utils'; +import { mountExtended } from 'helpers/vue_test_utils_helper'; import TokenProjectsTable from '~/token_access/components/token_projects_table.vue'; import { mockProjects } from './mock_data'; @@ -7,7 +7,7 @@ describe('Token projects table', () => { let wrapper; const createComponent = () => { - wrapper = mount(TokenProjectsTable, { + wrapper = mountExtended(TokenProjectsTable, { provide: { fullPath: 'root/ci-project', }, @@ -18,9 +18,11 @@ describe('Token projects table', () => { }; const findTable = () => wrapper.findComponent(GlTable); - const findAllTableRows = () => wrapper.findAll('[data-testid="projects-token-table-row"]'); const findDeleteProjectBtn = () => wrapper.findComponent(GlButton); const findAllDeleteProjectBtn = () => wrapper.findAllComponents(GlButton); + const findAllTableRows = () => wrapper.findAllByTestId('projects-token-table-row'); + const findProjectNameCell = () => wrapper.findByTestId('token-access-project-name'); + const findProjectNamespaceCell = () => wrapper.findByTestId('token-access-project-namespace'); beforeEach(() => { createComponent(); @@ -48,4 +50,9 @@ describe('Token projects table', () => { // currently two mock projects with one being a locked project expect(findAllDeleteProjectBtn()).toHaveLength(1); }); + + it('displays project and namespace cells', () => { + expect(findProjectNameCell().text()).toBe('merge-train-stuff'); + expect(findProjectNamespaceCell().text()).toBe('root'); + }); }); |