debian-mirror-gitlab/spec/frontend/ml/experiment_tracking/components/experiment_spec.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

45 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-01-13 00:05:48 +05:30
import { GlAlert } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import ShowExperiment from '~/ml/experiment_tracking/components/experiment.vue';
describe('ShowExperiment', () => {
let wrapper;
const createWrapper = (candidates = [], metricNames = [], paramNames = []) => {
return mountExtended(ShowExperiment, { provide: { candidates, metricNames, paramNames } });
};
const findAlert = () => wrapper.findComponent(GlAlert);
const findEmptyState = () => wrapper.findByText('This Experiment has no logged Candidates');
it('shows incubation warning', () => {
wrapper = createWrapper();
expect(findAlert().exists()).toBe(true);
});
describe('no candidates', () => {
it('shows empty state', () => {
wrapper = createWrapper();
expect(findEmptyState().exists()).toBe(true);
});
});
describe('with candidates', () => {
it('renders correctly', () => {
wrapper = createWrapper(
[
{ rmse: 1, l1_ratio: 0.4 },
{ auc: 0.3, l1_ratio: 0.5 },
],
['rmse', 'auc', 'mae'],
['l1_ratio'],
);
expect(wrapper.element).toMatchSnapshot();
});
});
});