From 78a403c450425ea86fad7df5737a4a53ed4c6714 Mon Sep 17 00:00:00 2001 From: donal <donalspring@gmail.com> Date: Mon, 16 Apr 2018 12:57:45 +0200 Subject: [PATCH] Template for TDD --- tests/unit/javascript/mutations.spec.js | 38 ++++++++++++++++++++++++++++++-------- 1 files changed, 30 insertions(+), 8 deletions(-) diff --git a/tests/unit/javascript/mutations.spec.js b/tests/unit/javascript/mutations.spec.js index 05df885..1a7fb82 100644 --- a/tests/unit/javascript/mutations.spec.js +++ b/tests/unit/javascript/mutations.spec.js @@ -3,17 +3,27 @@ let state; const todo = { - completed: true, - title: "testing sucks" + completed: true, + title: "testing sucks" }; const newTodo = "biscuits"; -const doneTodos = [{ +const doneTodos = [ + { completed: true, title: "testing sucks" -},{ + }, + { completed: false, title: "easy testing is fun" -}] + } +]; +const importantTodos = [ + { + completed: true, + title: "testing sucks", + important: true + } +]; describe("Mutation tests", () => { beforeEach(() => { @@ -39,7 +49,7 @@ }); it("ADD_TODO", () => { - state.todos = [] + state.todos = []; mutations.ADD_TODO(state, todo); expect(state.todos.length).toBe(1); }); @@ -47,13 +57,13 @@ it("CLEAR_NEW_TODO", () => { state.newTodo = newTodo; mutations.CLEAR_NEW_TODO(state, newTodo); - expect(state.newTodo).toEqual(''); + expect(state.newTodo).toEqual(""); }); it("CLEAR_NEW_TODO", () => { state.newTodo = newTodo; mutations.CLEAR_NEW_TODO(state); - expect(state.newTodo).toEqual(''); + expect(state.newTodo).toEqual(""); }); it("CLEAR_ALL_DONE_TODOS", () => { @@ -77,4 +87,16 @@ mutations.MARK_TODO_COMPLETED(state, 0); expect(state.todos[0].completed).toBe(true); }); + + it("it should MARK_TODO_IMPORTANT as false", () => { + state.todos = importantTodos; + // TODO - test goes here! + + }); + + it("it should MARK_TODO_IMPORTANT as true", () => { + state.todos = importantTodos; + // TODO - test goes here! + + }); }); -- Gitblit v1.9.3