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

candidate_list_row_spec.js « components « model_registry « ml « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5ac8d07ff0167f7c1297c5cb3f9488be7c16fd5d (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
import { GlLink, GlSprintf, GlTruncate } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import ListItem from '~/vue_shared/components/registry/list_item.vue';
import TimeAgoTooltip from '~/vue_shared/components/time_ago_tooltip.vue';
import CandidateListRow from '~/ml/model_registry/components/candidate_list_row.vue';
import { graphqlCandidates } from '../graphql_mock_data';

const CANDIDATE = graphqlCandidates[0];

let wrapper;
const createWrapper = (candidate = CANDIDATE) => {
  wrapper = shallowMount(CandidateListRow, {
    propsData: { candidate },
    stubs: {
      GlSprintf,
      GlTruncate,
    },
  });
};

const findListItem = () => wrapper.findComponent(ListItem);
const findLink = () => findListItem().findComponent(GlLink);
const findTruncated = () => findLink().findComponent(GlTruncate);
const findTooltip = () => findListItem().findComponent(TimeAgoTooltip);

describe('ml/model_registry/components/candidate_list_row.vue', () => {
  beforeEach(() => {
    createWrapper();
  });

  it('Has a link to the candidate', () => {
    expect(findTruncated().props('text')).toBe(CANDIDATE.name);
    expect(findLink().attributes('href')).toBe(CANDIDATE._links.showPath);
  });

  it('Shows created at', () => {
    expect(findTooltip().props('time')).toBe(CANDIDATE.createdAt);
  });
});