mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Test refetching a Post with its comments
This commit is contained in:
parent
b378bcb286
commit
745a326fbe
@ -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)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user