summaryrefslogtreecommitdiff
path: root/spec/javascripts/diffs/components/commit_widget_spec.js
blob: 2b60bd232ed4c86b600f5e2de0028bf72f5b7cc4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import Vue from 'vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
import CommitWidget from '~/diffs/components/commit_widget.vue';
import getDiffWithCommit from '../mock_data/diff_with_commit';

describe('diffs/components/commit_widget', () => {
  const Component = Vue.extend(CommitWidget);
  const { commit } = getDiffWithCommit();

  let vm;

  beforeEach(() => {
    vm = mountComponent(Component, {
      commit: getDiffWithCommit().commit,
    });
  });

  it('renders commit item', () => {
    const commitElement = vm.$el.querySelector('li.commit');

    expect(commitElement).not.toBeNull();
    expect(commitElement).toContainText(commit.short_id);
  });
});