summaryrefslogtreecommitdiff
path: root/spec/frontend/invite_members/components/confetti_spec.js
blob: 382569abfd956239422f8dcf4e460a08ad4fd48e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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(),
}));

const createComponent = () => {
  shallowMount(Confetti);
};

describe('Confetti', () => {
  it('initiates confetti', () => {
    const basicCannon = jest.spyOn(Confetti.methods, 'basicCannon').mockImplementation(() => {});

    createComponent();

    expect(confetti.create).toHaveBeenCalled();
    expect(basicCannon).toHaveBeenCalled();
  });
});