storj/web/satellite/tests/unit/common/VCheckbox.spec.ts
VitaliiShpital 3bbf08917c web/satellite: node packages updated
WHAT:
node packages updated to be up to date

Change-Id: Ic5a44c548562f16b23da59d3c39c4634572f7b35
2020-09-16 12:37:21 +00:00

42 lines
1.1 KiB
TypeScript

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
import Checkbox from '@/components/common/VCheckbox.vue';
import { mount, shallowMount } from '@vue/test-utils';
describe('Checkbox.vue', () => {
it('renders correctly', () => {
const wrapper = shallowMount(Checkbox);
expect(wrapper).toMatchSnapshot();
});
it('emit setData on change correctly', () => {
const wrapper = mount(Checkbox);
wrapper.find('input').trigger('change');
wrapper.find('input').trigger('change');
const emittedSetData = wrapper.emitted('setData');
if (emittedSetData) expect(emittedSetData.length).toEqual(2);
});
it('emits with data correctly', () => {
const wrapper = mount(Checkbox);
wrapper.vm.$emit('setData', true);
const emittedSetData = wrapper.emitted('setData');
if (emittedSetData) expect(emittedSetData[0][0]).toEqual(true);
});
it('renders correctly with error', () => {
const wrapper = shallowMount(Checkbox, {
propsData: {isCheckboxError: true},
});
expect(wrapper).toMatchSnapshot();
});
});