donal
2018-04-22 3bd680802264ee3f6d8e8dede670efb4d8de9878
tests/unit/vue-components/TodoItem.spec.js
@@ -1,3 +1,4 @@
/* eslint-disable */
import { shallow, mount, createLocalVue } from "@vue/test-utils";
import Vuex from "vuex";
import TodoItem from "@/components/TodoItem.vue";
@@ -19,7 +20,7 @@
    const wrapper = shallow(TodoItem, {
      propsData: { todoItem }
    });
    expect(wrapper.element).toMatchSnapshot();
    // expect(wrapper.element).toMatchSnapshot();
  });
  it("Renders title as 'Love Front End testing :)'", () => {
@@ -55,14 +56,12 @@
      propsData: { todoItem: importantTodo }
    });
    // TODO - test goes here!
    expect(wrapper.find(".important-flag").exists()).toBe(true);
  });
  it("should set the colour to red when true", () => {
    const wrapper = mount(TodoItem, {
      propsData: { todoItem: importantTodo }
    });
    // TODO - test goes here!
    expect(wrapper.find(".red-flag").exists()).toBe(true);
  });
  it("should set the colour to not red when false", () => {
    importantTodo.important = false;
@@ -70,7 +69,6 @@
      propsData: { todoItem: importantTodo }
    });
    // TODO - test goes here!
    expect(wrapper.find(".red-flag").exists()).toBe(false);
  });
  it("call makImportant when clicked", () => {
    const wrapper = mount(TodoItem, {
@@ -78,8 +76,5 @@
      propsData: { todoItem: importantTodo }
    });
    // TODO - test goes here!
    const input = wrapper.find(".important-flag");
    input.trigger("click");
    expect(methods.markImportant).toHaveBeenCalled();
  });
});