diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-20 13:00:54 +0300 |
commit | 3cccd102ba543e02725d247893729e5c73b38295 (patch) | |
tree | f36a04ec38517f5deaaacb5acc7d949688d1e187 /spec/frontend/terraform | |
parent | 205943281328046ef7b4528031b90fbda70c75ac (diff) |
Add latest changes from gitlab-org/gitlab@14-10-stable-eev14.10.0-rc42
Diffstat (limited to 'spec/frontend/terraform')
3 files changed, 47 insertions, 4 deletions
diff --git a/spec/frontend/terraform/components/empty_state_spec.js b/spec/frontend/terraform/components/empty_state_spec.js index b1303cf2b5e..21bfff5f1be 100644 --- a/spec/frontend/terraform/components/empty_state_spec.js +++ b/spec/frontend/terraform/components/empty_state_spec.js @@ -13,15 +13,20 @@ describe('EmptyStateComponent', () => { const findLink = () => wrapper.findComponent(GlLink); beforeEach(() => { - wrapper = shallowMount(EmptyState, { propsData, stubs: { GlEmptyState, GlLink } }); + wrapper = shallowMount(EmptyState, { propsData }); + }); + + afterEach(() => { + wrapper.destroy(); }); it('should render content', () => { - expect(findEmptyState().exists()).toBe(true); - expect(wrapper.text()).toContain('Get started with Terraform'); + expect(findEmptyState().props('title')).toBe( + "Your project doesn't have any Terraform state files", + ); }); - it('should have a link to the GitLab managed Terraform States docs', () => { + it('should have a link to the GitLab managed Terraform states docs', () => { expect(findLink().attributes('href')).toBe(docsUrl); }); }); diff --git a/spec/frontend/terraform/components/mock_data.js b/spec/frontend/terraform/components/mock_data.js new file mode 100644 index 00000000000..f0109047d4c --- /dev/null +++ b/spec/frontend/terraform/components/mock_data.js @@ -0,0 +1,35 @@ +export const getStatesResponse = { + data: { + project: { + id: 'project-1', + terraformStates: { + count: 1, + nodes: { + _showDetails: true, + errorMessages: [], + loadingLock: false, + loadingRemove: false, + id: 'state-1', + name: 'state', + lockedAt: '01-01-2022', + updatedAt: '01-01-2022', + lockedByUser: { + id: 'user-1', + avatarUrl: 'avatar', + name: 'User 1', + username: 'user-1', + webUrl: 'web', + }, + latestVersion: null, + }, + pageInfo: { + __typename: 'PageInfo', + hasNextPage: true, + hasPreviousPage: false, + startCursor: 'prev', + endCursor: 'next', + }, + }, + }, + }, +}; diff --git a/spec/frontend/terraform/components/states_table_actions_spec.js b/spec/frontend/terraform/components/states_table_actions_spec.js index a6c80b95af4..d01f6af9023 100644 --- a/spec/frontend/terraform/components/states_table_actions_spec.js +++ b/spec/frontend/terraform/components/states_table_actions_spec.js @@ -9,6 +9,8 @@ import StateActions from '~/terraform/components/states_table_actions.vue'; import lockStateMutation from '~/terraform/graphql/mutations/lock_state.mutation.graphql'; import removeStateMutation from '~/terraform/graphql/mutations/remove_state.mutation.graphql'; import unlockStateMutation from '~/terraform/graphql/mutations/unlock_state.mutation.graphql'; +import getStatesQuery from '~/terraform/graphql/queries/get_states.query.graphql'; +import { getStatesResponse } from './mock_data'; Vue.use(VueApollo); @@ -49,6 +51,7 @@ describe('StatesTableActions', () => { [lockStateMutation, lockResponse], [removeStateMutation, removeResponse], [unlockStateMutation, unlockResponse], + [getStatesQuery, jest.fn().mockResolvedValue(getStatesResponse)], ], { Mutation: { |