summaryrefslogtreecommitdiff
path: root/spec/frontend/ml/experiment_tracking/components/ml_candidate_spec.js
blob: fb45c4b07a45096c1e5c12ef6a4071bab40c38d9 (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
47
import { GlAlert } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import MlCandidate from '~/ml/experiment_tracking/components/ml_candidate.vue';

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

  const createWrapper = () => {
    const candidate = {
      params: [
        { name: 'Algorithm', value: 'Decision Tree' },
        { name: 'MaxDepth', value: '3' },
      ],
      metrics: [
        { name: 'AUC', value: '.55' },
        { name: 'Accuracy', value: '.99' },
      ],
      metadata: [
        { name: 'FileName', value: 'test.py' },
        { name: 'ExecutionTime', value: '.0856' },
      ],
      info: {
        iid: 'candidate_iid',
        artifact_link: 'path_to_artifact',
        experiment_name: 'The Experiment',
        experiment_path: 'path/to/experiment',
        status: 'SUCCESS',
      },
    };

    return mountExtended(MlCandidate, { provide: { candidate } });
  };

  const findAlert = () => wrapper.findComponent(GlAlert);

  it('shows incubation warning', () => {
    wrapper = createWrapper();

    expect(findAlert().exists()).toBe(true);
  });

  it('renders correctly', () => {
    wrapper = createWrapper();

    expect(wrapper.element).toMatchSnapshot();
  });
});