summaryrefslogtreecommitdiff
path: root/spec/frontend/set_status_modal/user_availability_status_spec.js
blob: 95ca0251ce017bf18bf19982d3342267048ea2c7 (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
29
30
31
import { shallowMount } from '@vue/test-utils';
import UserAvailabilityStatus from '~/set_status_modal/components/user_availability_status.vue';
import { AVAILABILITY_STATUS } from '~/set_status_modal/utils';

describe('UserAvailabilityStatus', () => {
  let wrapper;

  const createComponent = (props = {}) => {
    return shallowMount(UserAvailabilityStatus, {
      propsData: {
        ...props,
      },
    });
  };

  afterEach(() => {
    wrapper.destroy();
  });

  describe('with availability status', () => {
    it(`set to ${AVAILABILITY_STATUS.BUSY}`, () => {
      wrapper = createComponent({ availability: AVAILABILITY_STATUS.BUSY });
      expect(wrapper.text()).toContain('(Busy)');
    });

    it(`set to ${AVAILABILITY_STATUS.NOT_SET}`, () => {
      wrapper = createComponent({ availability: AVAILABILITY_STATUS.NOT_SET });
      expect(wrapper.html()).toBe('');
    });
  });
});