Correct commentTree failure unit-test - issue #1776
This commit is contained in:
@@ -12,7 +12,6 @@ import {
|
||||
import { CommentModeration } from "@/types/enums";
|
||||
import { IEvent } from "@/types/event.model";
|
||||
import {
|
||||
currentActorClientMock,
|
||||
eventCommentThreadsMock,
|
||||
eventNoCommentThreadsMock,
|
||||
newCommentForEventMock,
|
||||
@@ -28,7 +27,8 @@ 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";
|
||||
import { IDENTITIES } from "@/graphql/actor";
|
||||
import { defaultIdentityMock } from "../../mocks/auth";
|
||||
|
||||
config.global.plugins.push(Oruga);
|
||||
config.global.plugins.push(notifierPlugin);
|
||||
@@ -53,7 +53,7 @@ describe("CommentTree", () => {
|
||||
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: defaultResolvers,
|
||||
resolvers: defaultResolvers(cache),
|
||||
});
|
||||
|
||||
requestHandlers = {
|
||||
@@ -63,9 +63,7 @@ describe("CommentTree", () => {
|
||||
createCommentForEventMutationHandler: vi
|
||||
.fn()
|
||||
.mockResolvedValue(newCommentForEventResponse),
|
||||
getCurrentActorClientHandler: vi
|
||||
.fn()
|
||||
.mockResolvedValue(currentActorClientMock),
|
||||
identityHandler: vi.fn().mockResolvedValue(defaultIdentityMock),
|
||||
...handlers,
|
||||
};
|
||||
|
||||
@@ -77,10 +75,7 @@ describe("CommentTree", () => {
|
||||
CREATE_COMMENT_FROM_EVENT,
|
||||
requestHandlers.createCommentForEventMutationHandler
|
||||
);
|
||||
mockClient.setRequestHandler(
|
||||
CURRENT_ACTOR_CLIENT,
|
||||
requestHandlers.getCurrentActorClientHandler
|
||||
);
|
||||
mockClient.setRequestHandler(IDENTITIES, requestHandlers.identityHandler);
|
||||
wrapper = shallowMount(CommentTree, {
|
||||
props: {
|
||||
event: { ...eventData },
|
||||
|
||||
@@ -1,5 +1,36 @@
|
||||
// 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-->
|
||||
@@ -9,7 +40,26 @@ exports[`CommentTree > renders a loading comment tree 1`] = `
|
||||
|
||||
exports[`CommentTree > renders an empty comment tree 1`] = `
|
||||
"<div data-v-5d0380ab="">
|
||||
<!--v-if-->
|
||||
<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">
|
||||
<empty-content-stub data-v-5d0380ab="" icon="comment" descriptionclasses="" inline="true" center="false"></empty-content-stub>
|
||||
</transition-group-stub>
|
||||
|
||||
@@ -78,7 +78,7 @@ describe("ParticipationWithoutAccount", () => {
|
||||
) => {
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: defaultResolvers,
|
||||
resolvers: defaultResolvers(cache),
|
||||
});
|
||||
requestHandlers = {
|
||||
anonymousActorIdQueryHandler: vi
|
||||
|
||||
Reference in New Issue
Block a user