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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
import { shallowMount } from '@vue/test-utils';
import ClusterFormDropdown from '~/create_cluster/eks_cluster/components/cluster_form_dropdown.vue';
import RegionDropdown from '~/create_cluster/eks_cluster/components/region_dropdown.vue';
describe('RegionDropdown', () => {
const buildVM = (props = {}) =>
shallowMount(RegionDropdown, {
propsData: props,
});
it('renders a cluster-form-dropdown', () => {
expect(
buildVM()
.find(ClusterFormDropdown)
.exists(),
).toBe(true);
});
it('sets regions to cluster-form-dropdown items property', () => {
const regions = [{ name: 'basic' }];
const vm = buildVM({ regions });
expect(vm.find(ClusterFormDropdown).props('items')).toEqual(regions);
});
it('sets a loading text', () => {
const vm = buildVM();
expect(vm.find(ClusterFormDropdown).props('loadingText')).toEqual('Loading Regions');
});
it('sets a placeholder', () => {
const vm = buildVM();
expect(vm.find(ClusterFormDropdown).props('placeholder')).toEqual('Select a region');
});
it('sets an empty results text', () => {
const vm = buildVM();
expect(vm.find(ClusterFormDropdown).props('emptyText')).toEqual('No region found');
});
it('sets a search field placeholder', () => {
const vm = buildVM();
expect(vm.find(ClusterFormDropdown).props('searchFieldPlaceholder')).toEqual('Search regions');
});
it('sets hasErrors property', () => {
const vm = buildVM({ error: {} });
expect(vm.find(ClusterFormDropdown).props('hasErrors')).toEqual(true);
});
it('sets an error message', () => {
const vm = buildVM();
expect(vm.find(ClusterFormDropdown).props('errorMessage')).toEqual(
'Could not load regions from your AWS account',
);
});
});
|