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
|
import { shallowMount } from '@vue/test-utils';
import IntegrationSectionGooglePlay from '~/integrations/edit/components/sections/google_play.vue';
import UploadDropzoneField from '~/integrations/edit/components/upload_dropzone_field.vue';
import { createStore } from '~/integrations/edit/store';
describe('IntegrationSectionGooglePlay', () => {
let wrapper;
const createComponent = (fileName = '') => {
const store = createStore({
customState: {
fields: [
{
name: 'service_account_key_file_name',
value: fileName,
},
],
},
});
wrapper = shallowMount(IntegrationSectionGooglePlay, {
store,
});
};
const findUploadDropzoneField = () => wrapper.findComponent(UploadDropzoneField);
describe('computed properties', () => {
it('renders UploadDropzoneField with default values', () => {
createComponent();
const field = findUploadDropzoneField();
expect(field.exists()).toBe(true);
expect(field.props()).toMatchObject({
label: 'Service account key (.JSON)',
helpText: '',
});
});
it('renders UploadDropzoneField with custom values for an attached file', () => {
createComponent('fileName.txt');
const field = findUploadDropzoneField();
expect(field.exists()).toBe(true);
expect(field.props()).toMatchObject({
label: 'Upload a new service account key (replace fileName.txt)',
helpText: 'Leave empty to use your current service account key.',
});
});
});
});
|