debian-mirror-gitlab/spec/frontend/projects/clusters_deprecation_slert/components/clusters_deprecation_alert_spec.js
2022-07-23 20:15:48 +02:00

46 lines
1 KiB
JavaScript

import { GlAlert, GlSprintf } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import ClustersDeprecationAlert from '~/projects/clusters_deprecation_alert/components/clusters_deprecation_alert.vue';
const message = 'Alert message';
describe('ClustersDeprecationAlert', () => {
let wrapper;
const provideData = {
message,
};
const findAlert = () => wrapper.findComponent(GlAlert);
const createComponent = () => {
wrapper = shallowMount(ClustersDeprecationAlert, {
provide: provideData,
stubs: {
GlSprintf,
},
});
};
beforeEach(() => {
createComponent();
});
afterEach(() => {
wrapper.destroy();
});
describe('template', () => {
it('should render a non-dismissible warning alert', () => {
expect(findAlert().props()).toMatchObject({
dismissible: false,
variant: 'warning',
});
});
it('should display the correct message', () => {
expect(findAlert().text()).toBe(message);
});
});
});