This commit is contained in:
Tykayn 2021-12-09 16:02:54 +01:00 committed by tykayn
commit 8b9b1f7acc
3 changed files with 23 additions and 28 deletions

View File

@ -6,7 +6,7 @@
import { Component, Prop, Vue } from "vue-property-decorator"; import { Component, Prop, Vue } from "vue-property-decorator";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
import MobilizonLogo from "../assets/logo_chapril_mobilizon.png"; // import MobilizonLogo from "../assets/logo_chapril_mobilizon.png";
@Component @Component
export default class Logo extends Vue { export default class Logo extends Vue {

View File

@ -106,29 +106,27 @@ const decreaseFetches = () => {
Cypress.env("fetchCount", count - 1); Cypress.env("fetchCount", count - 1);
}; };
const buildTrackableFetchWithSessionId = (fetch) => ( const buildTrackableFetchWithSessionId =
fetchUrl, (fetch) => (fetchUrl, fetchOptions) => {
fetchOptions const { headers } = fetchOptions;
) => { const modifiedHeaders = {
const { headers } = fetchOptions; "x-session-id": Cypress.env("sessionId"),
const modifiedHeaders = { ...headers,
"x-session-id": Cypress.env("sessionId"), };
...headers,
const modifiedOptions = { ...fetchOptions, headers: modifiedHeaders };
return fetch(fetchUrl, modifiedOptions)
.then((result) => {
decreaseFetches();
return Promise.resolve(result);
})
.catch((result) => {
decreaseFetches();
return Promise.reject(result);
});
}; };
const modifiedOptions = { ...fetchOptions, headers: modifiedHeaders };
return fetch(fetchUrl, modifiedOptions)
.then((result) => {
decreaseFetches();
return Promise.resolve(result);
})
.catch((result) => {
decreaseFetches();
return Promise.reject(result);
});
};
Cypress.on("window:before:load", (win) => { Cypress.on("window:before:load", (win) => {
cy.stub(win, "fetch", buildTrackableFetchWithSessionId(fetch)); cy.stub(win, "fetch", buildTrackableFetchWithSessionId(fetch));
}); });

View File

@ -86,8 +86,7 @@ export const eventCommentThreadsMock = {
__typename: "Comment", __typename: "Comment",
id: "2", id: "2",
uuid: "e37910ea-fd5a-4756-9679-00971f3f4107", uuid: "e37910ea-fd5a-4756-9679-00971f3f4107",
url: url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-00971f3f4107",
"https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-00971f3f4107",
text: "my comment text", text: "my comment text",
local: true, local: true,
visibility: "PUBLIC", visibility: "PUBLIC",
@ -118,8 +117,7 @@ export const eventCommentThreadsMock = {
__typename: "Comment", __typename: "Comment",
id: "29", id: "29",
uuid: "e37910ea-fd5a-4756-9679-01171f3f4107", uuid: "e37910ea-fd5a-4756-9679-01171f3f4107",
url: url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4107",
"https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4107",
text: "a second comment", text: "a second comment",
local: true, local: true,
visibility: "PUBLIC", visibility: "PUBLIC",
@ -164,8 +162,7 @@ export const newCommentForEventResponse: DataMock = {
__typename: "Comment", __typename: "Comment",
id: "79", id: "79",
uuid: "e37910ea-fd5a-4756-9679-01171f3f4444", uuid: "e37910ea-fd5a-4756-9679-01171f3f4444",
url: url: "https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4444",
"https://some-instance.tld/comments/e37910ea-fd5a-4756-9679-01171f3f4444",
text: newCommentForEventMock.text, text: newCommentForEventMock.text,
local: true, local: true,
visibility: "PUBLIC", visibility: "PUBLIC",