@@ -9,11 +9,11 @@ import {
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import VueApollo from "vue-apollo";
|
||||
import { configMock } from "../../mocks/config";
|
||||
import { InMemoryCache } from "@apollo/client/cache";
|
||||
import { defaultResolvers } from "../../common";
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Buefy);
|
||||
@@ -42,11 +42,11 @@ describe("ParticipationSection", () => {
|
||||
customProps: Record<string, unknown> = {},
|
||||
baseData: Record<string, unknown> = {}
|
||||
) => {
|
||||
const cache = new InMemoryCache({ addTypename: true });
|
||||
const cache = new InMemoryCache({ addTypename: false });
|
||||
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
resolvers: defaultResolvers,
|
||||
});
|
||||
requestHandlers = {
|
||||
configQueryHandler: jest.fn().mockResolvedValue(configMock),
|
||||
@@ -62,6 +62,9 @@ describe("ParticipationSection", () => {
|
||||
localVue,
|
||||
router,
|
||||
apolloProvider,
|
||||
stubs: {
|
||||
ParticipationButton: true,
|
||||
},
|
||||
propsData: {
|
||||
participation: null,
|
||||
event: eventData,
|
||||
@@ -70,9 +73,6 @@ describe("ParticipationSection", () => {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
currentActor: {
|
||||
id: "76",
|
||||
},
|
||||
...baseData,
|
||||
};
|
||||
},
|
||||
@@ -89,14 +89,15 @@ describe("ParticipationSection", () => {
|
||||
|
||||
expect(wrapper.find(".event-participation").exists()).toBeTruthy();
|
||||
|
||||
const participationButton = wrapper.find(
|
||||
".event-participation .participation-button a.button.is-large.is-primary"
|
||||
);
|
||||
expect(participationButton.attributes("href")).toBe(
|
||||
`/events/${eventData.uuid}/participate/with-account`
|
||||
);
|
||||
// TODO: Move to participation button test
|
||||
// const participationButton = wrapper.find(
|
||||
// ".event-participation .participation-button a.button.is-large.is-primary"
|
||||
// );
|
||||
// expect(participationButton.attributes("href")).toBe(
|
||||
// `/events/${eventData.uuid}/participate/with-account`
|
||||
// );
|
||||
|
||||
expect(participationButton.text()).toBe("Participate");
|
||||
// expect(participationButton.text()).toBe("Participate");
|
||||
});
|
||||
|
||||
it("renders the participation section with existing confimed anonymous participation", async () => {
|
||||
|
||||
@@ -13,7 +13,6 @@ import {
|
||||
MockApolloClient,
|
||||
RequestHandler,
|
||||
} from "mock-apollo-client";
|
||||
import buildCurrentUserResolver from "@/apollo/user";
|
||||
import { CONFIG } from "@/graphql/config";
|
||||
import VueApollo from "vue-apollo";
|
||||
import { FETCH_EVENT_BASIC, JOIN_EVENT } from "@/graphql/event";
|
||||
@@ -26,6 +25,8 @@ import {
|
||||
joinEventResponseMock,
|
||||
} from "../../mocks/event";
|
||||
import { InMemoryCache } from "@apollo/client/cache";
|
||||
import { defaultResolvers } from "../../common";
|
||||
import flushPromises from "flush-promises";
|
||||
|
||||
const localVue = createLocalVue();
|
||||
localVue.use(Buefy);
|
||||
@@ -65,11 +66,11 @@ describe("ParticipationWithoutAccount", () => {
|
||||
customProps: Record<string, unknown> = {},
|
||||
baseData: Record<string, unknown> = {}
|
||||
) => {
|
||||
const cache = new InMemoryCache({ addTypename: true });
|
||||
const cache = new InMemoryCache({ addTypename: false });
|
||||
|
||||
mockClient = createMockClient({
|
||||
cache,
|
||||
resolvers: buildCurrentUserResolver(cache),
|
||||
resolvers: defaultResolvers,
|
||||
});
|
||||
requestHandlers = {
|
||||
configQueryHandler: jest.fn().mockResolvedValue(configMock),
|
||||
@@ -155,11 +156,7 @@ describe("ParticipationWithoutAccount", () => {
|
||||
eventData.participantStats.participant + 1
|
||||
);
|
||||
}
|
||||
// lots of things to await
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await wrapper.vm.$nextTick();
|
||||
await flushPromises();
|
||||
expect(wrapper.find("form").exists()).toBeFalsy();
|
||||
expect(wrapper.find("h1.title").text()).toBe(
|
||||
"Request for participation confirmation sent"
|
||||
|
||||
Reference in New Issue
Block a user