1import { mount, createLocalVue } from '@vue/test-utils';
2import InputPasswordToggle from '@/components/Global/InputPasswordToggle';
3import BootstrapVue from 'bootstrap-vue';
4
5const localVue = createLocalVue();
6localVue.use(BootstrapVue);
7
8describe('InputPasswordToggle.vue', () => {
9  const wrapper = mount(InputPasswordToggle, {
10    localVue,
11    data() {
12      return {
13        isVisible: false,
14      };
15    },
16    mocks: {
17      $t: (key) => key,
18    },
19  });
20  it('should exist', () => {
21    expect(wrapper.exists()).toBe(true);
22  });
23  it('should not render isVisible class', () => {
24    expect(wrapper.find('.isVisible').exists()).toBe(false);
25  });
26  it('should render isVisible class when button is clicked', async () => {
27    await wrapper.find('button').trigger('click');
28    expect(wrapper.find('.isVisible').exists()).toBe(true);
29  });
30  it('should render correctly', () => {
31    expect(wrapper.element).toMatchSnapshot();
32  });
33});
34