Commit 8c0bcc51 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera Committed by Nicolò Maria Mezzopera

Fix transient failure in commit_item_spec

only load mockData once
parent 652b09e8
...@@ -30,12 +30,12 @@ describe('diffs/components/commit_item', () => { ...@@ -30,12 +30,12 @@ describe('diffs/components/commit_item', () => {
const getCommitActionsElement = () => wrapper.find('.commit-actions'); const getCommitActionsElement = () => wrapper.find('.commit-actions');
const getCommitPipelineStatus = () => wrapper.find(CommitPipelineStatus); const getCommitPipelineStatus = () => wrapper.find(CommitPipelineStatus);
const defaultProps = { const mountComponent = propsData => {
commit: getDiffWithCommit().commit,
};
const mountComponent = (propsData = defaultProps) => {
wrapper = mount(Component, { wrapper = mount(Component, {
propsData, propsData: {
commit,
...propsData,
},
stubs: { stubs: {
CommitPipelineStatus: true, CommitPipelineStatus: true,
}, },
...@@ -59,9 +59,7 @@ describe('diffs/components/commit_item', () => { ...@@ -59,9 +59,7 @@ describe('diffs/components/commit_item', () => {
expect(titleElement.text()).toBe(commit.title_html); expect(titleElement.text()).toBe(commit.title_html);
}); });
// https://gitlab.com/gitlab-org/gitlab/-/issues/209776 it('renders commit description', () => {
// eslint-disable-next-line jest/no-disabled-tests
it.skip('renders commit description', () => {
const descElement = getDescElement(); const descElement = getDescElement();
const descExpandElement = getDescExpandElement(); const descExpandElement = getDescExpandElement();
...@@ -107,7 +105,7 @@ describe('diffs/components/commit_item', () => { ...@@ -107,7 +105,7 @@ describe('diffs/components/commit_item', () => {
describe('without commit description', () => { describe('without commit description', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ defaultProps, commit: { ...defaultProps.commit, description_html: '' } }); mountComponent({ commit: { ...commit, description_html: '' } });
}); });
it('hides description', () => { it('hides description', () => {
...@@ -122,9 +120,8 @@ describe('diffs/components/commit_item', () => { ...@@ -122,9 +120,8 @@ describe('diffs/components/commit_item', () => {
describe('with no matching user', () => { describe('with no matching user', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
defaultProps,
commit: { commit: {
...defaultProps.commit, ...commit,
author: null, author: null,
author_email: TEST_AUTHOR_EMAIL, author_email: TEST_AUTHOR_EMAIL,
author_name: TEST_AUTHOR_NAME, author_name: TEST_AUTHOR_NAME,
...@@ -154,8 +151,7 @@ describe('diffs/components/commit_item', () => { ...@@ -154,8 +151,7 @@ describe('diffs/components/commit_item', () => {
describe('with signature', () => { describe('with signature', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
defaultProps, commit: { ...commit, signature_html: TEST_SIGNATURE_HTML },
commit: { ...defaultProps.commit, signature_html: TEST_SIGNATURE_HTML },
}); });
}); });
...@@ -169,8 +165,7 @@ describe('diffs/components/commit_item', () => { ...@@ -169,8 +165,7 @@ describe('diffs/components/commit_item', () => {
describe('with pipeline status', () => { describe('with pipeline status', () => {
beforeEach(() => { beforeEach(() => {
mountComponent({ mountComponent({
defaultProps, commit: { ...commit, pipeline_status_path: TEST_PIPELINE_STATUS_PATH },
commit: { ...defaultProps.commit, pipeline_status_path: TEST_PIPELINE_STATUS_PATH },
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment