corrects tests (snapshot obsolet) - issue #1776
This commit is contained in:
@@ -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();
|
||||
});
|
||||
|
||||
@@ -1,36 +1,5 @@
|
||||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
||||
|
||||
exports[`CommentTree > renders a comment tree with comments 1`] = `
|
||||
"<div data-v-5d0380ab="">
|
||||
<form data-v-5d0380ab="" class="mt-2">
|
||||
<!--v-if-->
|
||||
<article data-v-5d0380ab="" class="flex flex-wrap items-start gap-2">
|
||||
<figure data-v-5d0380ab="" class="">
|
||||
<identity-picker-wrapper-stub data-v-5d0380ab="" modelvalue="[object Object]" inline="false" masked="false"></identity-picker-wrapper-stub>
|
||||
</figure>
|
||||
<div data-v-5d0380ab="" class="flex-1">
|
||||
<div data-v-5d0380ab="" class="flex flex-col gap-2">
|
||||
<div data-v-5d0380ab="" class="editor-wrapper">
|
||||
<editor-stub data-v-5d0380ab="" currentactor="[object Object]" mode="comment" modelvalue="" aria-label="Comment body" placeholder="Write a new comment"></editor-stub>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
<div data-v-5d0380ab="" class="">
|
||||
<o-button-stub data-v-5d0380ab="" tag="button" variant="primary" iconleft="send" rounded="false" expanded="false" disabled="false" outlined="false" loading="false" inverted="false" nativetype="submit" role="button" iconboth="false"></o-button-stub>
|
||||
</div>
|
||||
</article>
|
||||
</form>
|
||||
<transition-group-stub data-v-5d0380ab="" tag="div" name="comment-empty-list" appear="false" persisted="false" css="true" class="mt-2">
|
||||
<transition-group-stub data-v-5d0380ab="" name="comment-list" tag="ul" appear="false" persisted="false" css="true" class="comment-list">
|
||||
<event-comment-stub data-v-5d0380ab="" comment="[object Object]" event="[object Object]" currentactor="[object Object]" rootcomment="true" readonly="false" class="root-comment my-2"></event-comment-stub>
|
||||
<event-comment-stub data-v-5d0380ab="" comment="[object Object]" event="[object Object]" currentactor="[object Object]" rootcomment="true" readonly="false" class="root-comment my-2"></event-comment-stub>
|
||||
</transition-group-stub>
|
||||
</transition-group-stub>
|
||||
</div>"
|
||||
`;
|
||||
|
||||
exports[`CommentTree > renders a loading comment tree 1`] = `
|
||||
"<div data-v-5d0380ab="">
|
||||
<!--v-if-->
|
||||
@@ -40,26 +9,7 @@ exports[`CommentTree > renders a loading comment tree 1`] = `
|
||||
|
||||
exports[`CommentTree > renders an empty comment tree 1`] = `
|
||||
"<div data-v-5d0380ab="">
|
||||
<form data-v-5d0380ab="" class="mt-2">
|
||||
<!--v-if-->
|
||||
<article data-v-5d0380ab="" class="flex flex-wrap items-start gap-2">
|
||||
<figure data-v-5d0380ab="" class="">
|
||||
<identity-picker-wrapper-stub data-v-5d0380ab="" modelvalue="[object Object]" inline="false" masked="false"></identity-picker-wrapper-stub>
|
||||
</figure>
|
||||
<div data-v-5d0380ab="" class="flex-1">
|
||||
<div data-v-5d0380ab="" class="flex flex-col gap-2">
|
||||
<div data-v-5d0380ab="" class="editor-wrapper">
|
||||
<editor-stub data-v-5d0380ab="" currentactor="[object Object]" mode="comment" modelvalue="" aria-label="Comment body" placeholder="Write a new comment"></editor-stub>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
<!--v-if-->
|
||||
</div>
|
||||
</div>
|
||||
<div data-v-5d0380ab="" class="">
|
||||
<o-button-stub data-v-5d0380ab="" tag="button" variant="primary" iconleft="send" rounded="false" expanded="false" disabled="false" outlined="false" loading="false" inverted="false" nativetype="submit" role="button" iconboth="false"></o-button-stub>
|
||||
</div>
|
||||
</article>
|
||||
</form>
|
||||
<!--v-if-->
|
||||
<transition-group-stub data-v-5d0380ab="" tag="div" name="comment-empty-list" appear="false" persisted="false" css="true" class="mt-2">
|
||||
<empty-content-stub data-v-5d0380ab="" icon="comment" descriptionclasses="" inline="true" center="false"></empty-content-stub>
|
||||
</transition-group-stub>
|
||||
|
||||
@@ -26,5 +26,6 @@ exports[`App component > renders a Vue component 1`] = `
|
||||
<path fill-rule="evenodd" d="M3 5a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 10a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1zM3 15a1 1 0 011-1h12a1 1 0 110 2H4a1 1 0 01-1-1z" clip-rule="evenodd"></path>
|
||||
</svg></button>
|
||||
</div>
|
||||
</nav>"
|
||||
</nav>
|
||||
<!--v-if-->"
|
||||
`;
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user