commit | author | age
|
3bd680
|
1 |
/* eslint-disable */ |
D |
2 |
import { shallow, createLocalVue } from "@vue/test-utils"; |
b0b888
|
3 |
import Vuex from "vuex"; |
A |
4 |
import XofYItems from "@/components/XofYItems.vue"; |
|
5 |
|
|
6 |
const localVue = createLocalVue(); |
|
7 |
|
|
8 |
localVue.use(Vuex); |
|
9 |
|
3bd680
|
10 |
let store; |
b0b888
|
11 |
describe("XofYItems.vue", () => { |
A |
12 |
const actions = { |
|
13 |
loadTodos: jest.fn(), |
|
14 |
clearTodos: jest.fn() |
|
15 |
}; |
|
16 |
const getters = { |
|
17 |
todos: jest.fn() |
|
18 |
}; |
|
19 |
|
|
20 |
beforeEach(() => { |
|
21 |
store = new Vuex.Store({ |
|
22 |
state: {}, |
|
23 |
actions, |
|
24 |
getters |
|
25 |
}); |
|
26 |
}); |
|
27 |
|
|
28 |
it("returns the correct length of todos", () => { |
|
29 |
const mockedTodos = [ |
|
30 |
{ |
|
31 |
title: "Learn awesome things about Labs", |
|
32 |
completed: true, |
|
33 |
important: false |
|
34 |
}, |
|
35 |
{ |
|
36 |
title: "Learn more awesome things about Labs", |
|
37 |
completed: true, |
|
38 |
important: false |
|
39 |
}, |
|
40 |
{ |
|
41 |
title: "Learn even more awesome things about Labs", |
|
42 |
completed: false, |
|
43 |
important: false |
|
44 |
} |
|
45 |
]; |
|
46 |
|
d3c92c
|
47 |
expect(mockedTodos.length).toEqual(3); |
b0b888
|
48 |
}); |
A |
49 |
}); |