summaryrefslogtreecommitdiff
path: root/spec/frontend/usage_quotas/components/usage_quotas_app_spec.js
blob: 3508bf7cfde9b68f8a9ace44fd4c3ccef8c9baa5 (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
import { GlSprintf } from '@gitlab/ui';
import { shallowMountExtended } from 'helpers/vue_test_utils_helper';
import UsageQuotasApp from '~/usage_quotas/components/usage_quotas_app.vue';
import { USAGE_QUOTAS_TITLE } from '~/usage_quotas/constants';
import { defaultProvide } from '../mock_data';

describe('UsageQuotasApp', () => {
  let wrapper;

  const createComponent = ({ provide = {} } = {}) => {
    wrapper = shallowMountExtended(UsageQuotasApp, {
      provide: {
        ...defaultProvide,
        ...provide,
      },
      stubs: {
        GlSprintf,
      },
    });
  };

  beforeEach(() => {
    createComponent();
  });

  const findSubTitle = () => wrapper.findByTestId('usage-quotas-page-subtitle');

  it('renders the view title', () => {
    expect(wrapper.text()).toContain(USAGE_QUOTAS_TITLE);
  });

  it('renders the view subtitle', () => {
    expect(findSubTitle().text()).toContain(defaultProvide.namespaceName);
  });
});