debian-mirror-gitlab/spec/frontend/invite_members/components/confetti_spec.js
2021-12-11 22:18:48 +05:30

28 lines
638 B
JavaScript

import { shallowMount } from '@vue/test-utils';
import confetti from 'canvas-confetti';
import Confetti from '~/invite_members/components/confetti.vue';
jest.mock('canvas-confetti', () => ({
create: jest.fn(),
}));
let wrapper;
const createComponent = () => {
wrapper = shallowMount(Confetti);
};
afterEach(() => {
wrapper.destroy();
});
describe('Confetti', () => {
it('initiates confetti', () => {
const basicCannon = jest.spyOn(Confetti.methods, 'basicCannon').mockImplementation(() => {});
createComponent();
expect(confetti.create).toHaveBeenCalled();
expect(basicCannon).toHaveBeenCalled();
});
});