donal
2018-04-12 9d6970d15ace1d033858f40e1e1459eeca6c6690
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import store from "@/store";
import * as all from "../setup.js";
 
describe("Initial state tests", () => {
  it("should have no todos by default", () => {
    expect(store.state.todos.length).toBe(0);
  });
  it("should have no newTodo by default", () => {
    expect(store.state.newTodo).toBe("");
  });
  it("should have loading true by default", () => {
    expect(store.state.loading).toBe(true);
  });
  /*
  state: {
    loading: true,
    todos: [],
    newTodo: ""
  },
  getters: {
    newTodo: state => state.newTodo,
    todos: state => state.todos
  },
  
  */
});
 
describe("state getters", () => {
  it("get newTodo should be empty string", () => {
    expect(store.getters.newTodo).toBe("");
  });
  it("should have empty todos on get", () => {
    expect(store.getters.todos.length).toBe(0);
  });
});