summaryrefslogtreecommitdiff
path: root/spec/frontend/invite_members/components/confetti_spec.js
blob: 2f361f1dc1e93f472fab1057f03910c9a6bc25b5 (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
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();
  });
});