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`] = ` -"
-
- -
-
- -
-
-
-
- - -
- -
-
-
- -
-
-
- - - - - - -
" -`; - exports[`CommentTree > renders a loading comment tree 1`] = ` "
@@ -40,26 +9,7 @@ exports[`CommentTree > renders a loading comment tree 1`] = ` exports[`CommentTree > renders an empty comment tree 1`] = ` "
-
- -
-
- -
-
-
-
- - -
- -
-
-
- -
-
-
+ diff --git a/tests/unit/specs/components/__snapshots__/navbar.spec.ts.snap b/tests/unit/specs/components/__snapshots__/navbar.spec.ts.snap index 2d7655be2..9e97cd86d 100644 --- a/tests/unit/specs/components/__snapshots__/navbar.spec.ts.snap +++ b/tests/unit/specs/components/__snapshots__/navbar.spec.ts.snap @@ -26,5 +26,6 @@ exports[`App component > renders a Vue component 1`] = `
-" + +" `; diff --git a/tests/unit/specs/mocks/event.ts b/tests/unit/specs/mocks/event.ts index 206794746..23aa6e427 100644 --- a/tests/unit/specs/mocks/event.ts +++ b/tests/unit/specs/mocks/event.ts @@ -51,6 +51,19 @@ export const joinEventResponseMock = { }, }; +export const currentActorClientMock = { + data: { + actor: { + __typename: "Person", + preferredUsername: "some_actor", + name: "Some actor", + avatar: null, + domain: null, + id: "1", + }, + }, +}; + export const joinEventMock = { eventId: "1", actorId: "1",