summaryrefslogtreecommitdiff
path: root/spec/frontend/ide/components/commit_sidebar/success_message_spec.js
blob: 52e35bdbb73043d1230243ff97d8bc0e19daccb6 (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
25
26
27
28
29
30
31
32
import Vue, { nextTick } from 'vue';
import { createComponentWithStore } from 'helpers/vue_mount_component_helper';
import successMessage from '~/ide/components/commit_sidebar/success_message.vue';
import { createStore } from '~/ide/stores';

describe('IDE commit panel successful commit state', () => {
  let vm;
  let store;

  beforeEach(() => {
    store = createStore();

    const Component = Vue.extend(successMessage);

    vm = createComponentWithStore(Component, store, {
      committedStateSvgPath: 'committed-state',
    });

    vm.$mount();
  });

  afterEach(() => {
    vm.$destroy();
  });

  it('renders last commit message when it exists', async () => {
    vm.$store.state.lastCommitMsg = 'testing commit message';

    await nextTick();
    expect(vm.$el.textContent).toContain('testing commit message');
  });
});