diff --git a/tests/unit/specs/components/Comment/CommentTree.spec.ts b/tests/unit/specs/components/Comment/CommentTree.spec.ts index 7b47282b8..77de4eeaf 100644 --- a/tests/unit/specs/components/Comment/CommentTree.spec.ts +++ b/tests/unit/specs/components/Comment/CommentTree.spec.ts @@ -12,6 +12,7 @@ import { import { CommentModeration } from "@/types/enums"; import { IEvent } from "@/types/event.model"; import { + currentActorClientMock, eventCommentThreadsMock, eventNoCommentThreadsMock, newCommentForEventMock, @@ -27,6 +28,7 @@ import { InMemoryCache } from "@apollo/client/cache"; import { createRouter, createWebHistory, Router } from "vue-router"; import { routes } from "@/router"; import { dialogPlugin } from "@/plugins/dialog"; +import { CURRENT_ACTOR_CLIENT } from "@/graphql/actor"; config.global.plugins.push(Oruga); config.global.plugins.push(notifierPlugin); @@ -61,6 +63,9 @@ describe("CommentTree", () => { createCommentForEventMutationHandler: vi .fn() .mockResolvedValue(newCommentForEventResponse), + getCurrentActorClientHandler: vi + .fn() + .mockResolvedValue(currentActorClientMock), ...handlers, }; @@ -72,6 +77,10 @@ describe("CommentTree", () => { CREATE_COMMENT_FROM_EVENT, requestHandlers.createCommentForEventMutationHandler ); + mockClient.setRequestHandler( + CURRENT_ACTOR_CLIENT, + requestHandlers.getCurrentActorClientHandler + ); wrapper = shallowMount(CommentTree, { props: { event: { ...eventData }, @@ -110,6 +119,7 @@ describe("CommentTree", () => { }); it("renders a comment tree with comments", async () => { + console.log(">>>>> <<<<<"); generateWrapper(); expect(wrapper.exists()).toBe(true); @@ -119,6 +129,7 @@ describe("CommentTree", () => { await flushPromises(); expect(wrapper.find("p.text-center").exists()).toBe(false); + console.log(">>>>> <<<<<", wrapper.html()); expect(wrapper.findAllComponents("event-comment-stub").length).toBe(2); expect(wrapper.html()).toMatchSnapshot(); }); diff --git a/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap b/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap index 901310f7d..53044db2f 100644 --- a/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap +++ b/tests/unit/specs/components/Comment/__snapshots__/CommentTree.spec.ts.snap @@ -1,36 +1,5 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`CommentTree > renders a comment tree with comments 1`] = ` -"