Test refetching a Post with its comments

This commit is contained in:
Matt Rider 2019-05-27 19:16:27 -03:00
parent b378bcb286
commit 745a326fbe

View File

@ -33,6 +33,13 @@ describe('CommentList.vue', () => {
})
mocks = {
$t: jest.fn(),
$apollo: {
queries: {
Post: {
refetch: jest.fn(),
},
},
},
}
data = () => {
return {
@ -63,5 +70,10 @@ describe('CommentList.vue', () => {
it('displays comments when there are comments to display', () => {
expect(wrapper.find('div#comments').text()).toEqual('this is a comment')
})
it("refetches a post's comments from the backend", () => {
wrapper.vm.refetchPostComments()
expect(mocks.$apollo.queries.Post.refetch).toHaveBeenCalledTimes(1)
})
})
})