tests/unit/NewTodo.spec.js | ●●●●● patch | view | raw | blame | history | |
tests/unit/TodoItem.spec.js | ●●●●● patch | view | raw | blame | history | |
tests/unit/__snapshots__/TodoItem.spec.js.snap | ●●●●● patch | view | raw | blame | history |
tests/unit/NewTodo.spec.js
@@ -18,4 +18,16 @@ expect(wrapper.vm.newTodo).toMatch(""); }); }); // it('has the expected html structure', () => { // const wrapper = shallow(NewTodo); // expect(wrapper.element).toMatchSnapshot() // }); // it("renders newTodo as test string ", () => { // const wrapper = shallow(NewTodo, { // propsData: { newTodo: "test string" } // }); // expect(wrapper.vm.newTodo).toMatch("test string"); // }); }); tests/unit/TodoItem.spec.js
New file @@ -0,0 +1,44 @@ import { shallow } from "@vue/test-utils"; import TodoItem from "@/components/TodoItem.vue"; // import { expect } from 'chai' import * as all from "../unit/setup.js"; describe("TodoItem.vue", () => { it("has the expected html structure", () => { const todoItem = { }; const wrapper = shallow(TodoItem, { propsData: { todoItem } }); expect(wrapper.element).toMatchSnapshot(); }); // it("has the expected html structure", () => { // const todoItem = { // completed: false, // title: "", // important: false // }; // const wrapper = shallow(TodoItem, { // propsData: { todoItem } // }); // expect(wrapper.element).toMatchSnapshot(); // }); // it("renders props.placeholderMsg when passed", () => { // const msg = "Add a Todo"; // const wrapper = shallow(NewTodo, { // propsData: { placeholderMsg: msg } // }); // expect(wrapper.vm._props.placeholderMsg).toMatch(msg); // }); // it("renders newTodo as empty string", () => { // const wrapper = shallow(NewTodo, {}); // expect(wrapper.vm.newTodo).toMatch(""); // }); }); tests/unit/__snapshots__/TodoItem.spec.js.snap
New file @@ -0,0 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`TodoItem.vue has the expected html structure 1`] = ` <div> <div class="itemCardAndFlag" > <!----> <!----> </div> </div> `;