Welcome to mirror list, hosted at ThFree Co, Russian Federation.

service_table_spec.js « databases « google_cloud « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4594e1758adc0b9b06ea4879502512321ab4e66a (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
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 });
  });

  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);
  });
});