donal
2018-04-16 78a403c450425ea86fad7df5737a4a53ed4c6714
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!
  });
});