Fix Vue unit tests

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel
2021-06-04 20:24:43 +02:00
parent f100fce0da
commit 51106841ab
18 changed files with 283 additions and 66 deletions

View File

@@ -99,9 +99,7 @@ import { ApolloCache, FetchResult, InMemoryCache } from "@apollo/client/core";
@Component({
apollo: {
currentActor: {
query: CURRENT_ACTOR_CLIENT,
},
currentActor: CURRENT_ACTOR_CLIENT,
comments: {
query: COMMENTS_THREADS_WITH_REPLIES,
variables() {
@@ -152,7 +150,6 @@ export default class CommentTree extends Vue {
}
async createCommentForEvent(comment: IComment): Promise<void> {
console.log("creating comment", comment);
this.emptyCommentError = ["", "<p></p>"].includes(comment.text);
if (this.emptyCommentError) return;
try {

View File

@@ -217,25 +217,24 @@ export default class ParticipationWithoutAccount extends Vue {
);
return;
}
const { event } = cachedData;
if (event === null) {
console.error(
"Cannot update event participant cache, because of null value."
);
return;
}
const participantStats = { ...cachedData.event.participantStats };
if (updateData.joinEvent.role === ParticipantRole.NOT_CONFIRMED) {
event.participantStats.notConfirmed += 1;
participantStats.notConfirmed += 1;
} else {
event.participantStats.going += 1;
event.participantStats.participant += 1;
participantStats.going += 1;
participantStats.participant += 1;
}
store.writeQuery({
query: FETCH_EVENT_BASIC,
variables: { uuid: this.event.uuid },
data: { event },
data: {
event: {
...cachedData.event,
participantStats,
},
},
});
},
});