debian-mirror-gitlab/spec/frontend/clusters/components/uninstall_application_button_spec.js

40 lines
1.2 KiB
JavaScript
Raw Normal View History

2019-07-31 22:56:46 +05:30
import { shallowMount } from '@vue/test-utils';
2020-11-24 15:15:51 +05:30
import { GlButton } from '@gitlab/ui';
2019-07-31 22:56:46 +05:30
import UninstallApplicationButton from '~/clusters/components/uninstall_application_button.vue';
import { APPLICATION_STATUS } from '~/clusters/constants';
const { INSTALLED, UPDATING, UNINSTALLING } = APPLICATION_STATUS;
describe('UninstallApplicationButton', () => {
let wrapper;
const createComponent = (props = {}) => {
wrapper = shallowMount(UninstallApplicationButton, {
propsData: { ...props },
});
};
afterEach(() => {
wrapper.destroy();
});
describe.each`
2020-11-24 15:15:51 +05:30
status | loading | disabled | text
2019-07-31 22:56:46 +05:30
${INSTALLED} | ${false} | ${false} | ${'Uninstall'}
${UPDATING} | ${false} | ${true} | ${'Uninstall'}
${UNINSTALLING} | ${true} | ${true} | ${'Uninstalling'}
2020-11-24 15:15:51 +05:30
`('when app status is $status', ({ loading, disabled, status, text }) => {
beforeAll(() => {
2019-07-31 22:56:46 +05:30
createComponent({ status });
2020-11-24 15:15:51 +05:30
});
it(`renders a button with loading=${loading} and disabled=${disabled}`, () => {
expect(wrapper.find(GlButton).props()).toMatchObject({ loading, disabled });
});
it(`renders a button with text="${text}"`, () => {
expect(wrapper.find(GlButton).text()).toBe(text);
2019-07-31 22:56:46 +05:30
});
});
});