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

function_row_spec.js « components « serverless « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 76a9e1493026b1bd522bfa62237b9ba6977d5b46 (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
import { shallowMount } from '@vue/test-utils';
import functionRowComponent from '~/serverless/components/function_row.vue';
import Timeago from '~/vue_shared/components/time_ago_tooltip.vue';

import { mockServerlessFunction } from '../mock_data';

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

  const createComponent = func => {
    wrapper = shallowMount(functionRowComponent, {
      propsData: { func },
    });
  };

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

  it('Parses the function details correctly', () => {
    createComponent(mockServerlessFunction);

    expect(wrapper.find('b').text()).toBe(mockServerlessFunction.name);
    expect(wrapper.find('span').text()).toBe(mockServerlessFunction.image);
    expect(wrapper.find(Timeago).attributes('time')).not.toBe(null);
  });

  it('handles clicks correctly', () => {
    createComponent(mockServerlessFunction);
    const { vm } = wrapper;

    expect(vm.checkClass(vm.$el.querySelector('p'))).toBe(true); // check somewhere inside the row
  });
});