Commit 7d7fd437 authored by Tom Quirk's avatar Tom Quirk

Refactor active_checkbox_spec to not mock computed

Mocks the state instead, to ensure we don't
mock the computed value. This gives us test
coverage of the computed value for free.
parent 83d80428
......@@ -6,31 +6,27 @@ import { createStore } from '~/integrations/edit/store';
describe('ActiveCheckbox', () => {
let wrapper;
const createComponent = (customStateProps = {}, isInheriting = false) => {
const createComponent = (customStateProps = {}, { isInheriting = false } = {}) => {
wrapper = mount(ActiveCheckbox, {
store: createStore({
customState: { ...customStateProps },
override: !isInheriting,
defaultState: isInheriting ? {} : undefined,
}),
computed: {
isInheriting: () => isInheriting,
},
});
};
afterEach(() => {
if (wrapper) {
wrapper.destroy();
wrapper = null;
}
wrapper.destroy();
});
const findGlFormCheckbox = () => wrapper.find(GlFormCheckbox);
const findGlFormCheckbox = () => wrapper.findComponent(GlFormCheckbox);
const findInputInCheckbox = () => findGlFormCheckbox().find('input');
describe('template', () => {
describe('is inheriting adminSettings', () => {
it('renders GlFormCheckbox as disabled', () => {
createComponent({}, true);
createComponent({}, { isInheriting: true });
expect(findGlFormCheckbox().exists()).toBe(true);
expect(findInputInCheckbox().attributes('disabled')).toBe('disabled');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment