blob: 4a622e544e10a9a51fda8fd88a290a1c3934a343 (
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
|
import { GlTable } from '@gitlab/ui';
import { mountExtended } from 'helpers/vue_test_utils_helper';
import ServiceTable from '~/google_cloud/databases/service_table.vue';
describe('google_cloud/databases/service_table', () => {
let wrapper;
const findTable = () => wrapper.findComponent(GlTable);
beforeEach(() => {
const propsData = {
cloudsqlPostgresUrl: '#url-cloudsql-postgres',
cloudsqlMysqlUrl: '#url-cloudsql-mysql',
cloudsqlSqlserverUrl: '#url-cloudsql-sqlserver',
alloydbPostgresUrl: '#url-alloydb-postgres',
memorystoreRedisUrl: '#url-memorystore-redis',
firestoreUrl: '#url-firestore',
};
wrapper = mountExtended(ServiceTable, { propsData });
});
afterEach(() => {
wrapper.destroy();
});
it('should contain a table', () => {
expect(findTable().exists()).toBe(true);
});
it.each`
name | testId | url
${'cloudsql-postgres'} | ${'button-cloudsql-postgres'} | ${'#url-cloudsql-postgres'}
${'cloudsql-mysql'} | ${'button-cloudsql-mysql'} | ${'#url-cloudsql-mysql'}
${'cloudsql-sqlserver'} | ${'button-cloudsql-sqlserver'} | ${'#url-cloudsql-sqlserver'}
${'alloydb-postgres'} | ${'button-alloydb-postgres'} | ${'#url-alloydb-postgres'}
${'memorystore-redis'} | ${'button-memorystore-redis'} | ${'#url-memorystore-redis'}
${'firestore'} | ${'button-firestore'} | ${'#url-firestore'}
`('renders $name button with correct url', ({ testId, url }) => {
const button = wrapper.findByTestId(testId);
expect(button.exists()).toBe(true);
expect(button.attributes('href')).toBe(url);
});
});
|