Skip to content

Commit d84e9d9

Browse files
committed
Create minimal test for FollowButtons
1 parent 633aa2c commit d84e9d9

1 file changed

Lines changed: 45 additions & 0 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import { shallowMount, mount, createLocalVue } from '@vue/test-utils'
2+
import Vuex from 'vuex'
3+
import FollowButtons from './FollowButtons'
4+
5+
const localVue = createLocalVue()
6+
7+
localVue.use(Vuex)
8+
9+
const propsData = {
10+
entity: {
11+
_id: 4711,
12+
name: 'author'
13+
}
14+
}
15+
16+
const mocks = { $t: () => {} }
17+
18+
describe('FollowButtons.vue', () => {
19+
let wrapper
20+
let actions
21+
let getters
22+
let store
23+
let currentUser
24+
25+
beforeEach(() => {
26+
currentUser = {
27+
_id: 42
28+
}
29+
getters = {
30+
'auth/user': () => { return currentUser },
31+
}
32+
actions = {
33+
'connections/syncFollow': () => {
34+
}
35+
}
36+
store = new Vuex.Store({
37+
state: {}, getters, actions
38+
})
39+
})
40+
41+
test('renders', () => {
42+
wrapper = shallowMount(FollowButtons, { store, localVue, propsData, mocks })
43+
expect(wrapper.is('div')).toBeTruthy()
44+
})
45+
})

0 commit comments

Comments
 (0)