diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-07 15:08:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-07 15:08:52 +0300 |
commit | 28f0cd8e0725320c294f9dbf74c698ee727de594 (patch) | |
tree | 5e2ba5fc09fbddc0ac88d8b726795f8c62922a3b /spec/frontend/work_items/components/work_item_created_updated_spec.js | |
parent | 929712792964c31c895cb83ebf0862da038c57a0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/work_items/components/work_item_created_updated_spec.js')
-rw-r--r-- | spec/frontend/work_items/components/work_item_created_updated_spec.js | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/spec/frontend/work_items/components/work_item_created_updated_spec.js b/spec/frontend/work_items/components/work_item_created_updated_spec.js index 68ede7d5bc0..428b33aecfa 100644 --- a/spec/frontend/work_items/components/work_item_created_updated_spec.js +++ b/spec/frontend/work_items/components/work_item_created_updated_spec.js @@ -5,6 +5,7 @@ import VueApollo from 'vue-apollo'; import createMockApollo from 'helpers/mock_apollo_helper'; import waitForPromises from 'helpers/wait_for_promises'; import WorkItemCreatedUpdated from '~/work_items/components/work_item_created_updated.vue'; +import WorkItemTypeIcon from '~/work_items/components/work_item_type_icon.vue'; import workItemByIidQuery from '~/work_items/graphql/work_item_by_iid.query.graphql'; import { workItemByIidResponseFactory, mockAssignees } from '../mock_data'; @@ -18,6 +19,7 @@ describe('WorkItemCreatedUpdated component', () => { const findUpdatedAt = () => wrapper.find('[data-testid="work-item-updated"]'); const findCreatedAtText = () => findCreatedAt().text().replace(/\s+/g, ' '); + const findWorkItemTypeIcon = () => wrapper.findComponent(WorkItemTypeIcon); const createComponent = async ({ workItemIid = '1', author = null, updatedAt } = {}) => { const workItemQueryResponse = workItemByIidResponseFactory({ @@ -48,17 +50,31 @@ describe('WorkItemCreatedUpdated component', () => { expect(successHandler).not.toHaveBeenCalled(); }); + it('shows work item type metadata with type and icon', async () => { + await createComponent(); + + const { + data: { workspace: { workItems } = {} }, + } = workItemByIidResponseFactory(); + + expect(findWorkItemTypeIcon().props()).toMatchObject({ + showText: true, + workItemIconName: workItems.nodes[0].workItemType.iconName, + workItemType: workItems.nodes[0].workItemType.name, + }); + }); + it('shows author name and link', async () => { const author = mockAssignees[0]; await createComponent({ author }); - expect(findCreatedAtText()).toBe(`Created by ${author.name}`); + expect(findCreatedAtText()).toBe(`created by ${author.name}`); }); it('shows created time when author is null', async () => { await createComponent({ author: null }); - expect(findCreatedAtText()).toBe('Created'); + expect(findCreatedAtText()).toBe('created'); }); it('shows updated time', async () => { |