Welcome to mirror list, hosted at ThFree Co, Russian Federation.

note_edited_text_spec.js « components « notes « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4671bc6629c82902065636726f342b5ff1a2815a (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import { shallowMount } from '@vue/test-utils';
import NoteEditedText from '~/notes/components/note_edited_text.vue';

const propsData = {
  actionText: 'Edited',
  className: 'foo-bar',
  editedAt: '2017-08-04T09:52:31.062Z',
  editedBy: {
    avatar_url: 'path',
    id: 1,
    name: 'Root',
    path: '/root',
    state: 'active',
    username: 'root',
  },
};

describe('NoteEditedText', () => {
  let wrapper;

  beforeEach(() => {
    wrapper = shallowMount(NoteEditedText, {
      propsData,
      attachToDocument: true,
    });
  });

  afterEach(() => {
    wrapper.destroy();
  });

  it('should render block with provided className', () => {
    expect(wrapper.classes()).toContain(propsData.className);
  });

  it('should render provided actionText', () => {
    expect(wrapper.text().trim()).toContain(propsData.actionText);
  });

  it('should render provided user information', () => {
    const authorLink = wrapper.find('.js-user-link');

    expect(authorLink.attributes('href')).toEqual(propsData.editedBy.path);
    expect(authorLink.text().trim()).toEqual(propsData.editedBy.name);
  });
});