From 7a7144da66cf5070aee1d23ae695b6291a0deb2e Mon Sep 17 00:00:00 2001 From: acammies <acammies@redhat.com> Date: Mon, 09 Apr 2018 18:32:25 +0200 Subject: [PATCH] added more tests --- tests/unit/TodoItem.spec.js | 42 ++++++++++++++++++++++++++++++------------ 1 files changed, 30 insertions(+), 12 deletions(-) diff --git a/tests/unit/TodoItem.spec.js b/tests/unit/TodoItem.spec.js index a366824..3622097 100644 --- a/tests/unit/TodoItem.spec.js +++ b/tests/unit/TodoItem.spec.js @@ -7,24 +7,42 @@ describe("TodoItem.vue", () => { it("has the expected html structure", () => { - const todoItem = { }; + 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 title as 'TestTitle'", () => { + const todoItem = { + title: "TestTitle" + }; + const wrapper = shallow(TodoItem, { + propsData: { todoItem } + }); + expect(wrapper.vm.todoItem.title).toMatch("TestTitle"); + }); + + it("Renders completed as true", () => { + const todoItem = { + completed : true + }; + const wrapper = shallow(TodoItem, { + propsData: { todoItem } + }); + expect(wrapper.vm.todoItem.completed).toEqual(true); + }); + + it("Renders important as false", () => { + const todoItem = { + important : false + }; + const wrapper = shallow(TodoItem, { + propsData: { todoItem } + }); + expect(wrapper.vm.todoItem.important).toEqual(false); + }); // it("renders props.placeholderMsg when passed", () => { // const msg = "Add a Todo"; -- Gitblit v1.9.3