blob: 081edd33b3be8364e17af9573664c6a40582bfa8 (
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
});
});
|