Skip to content

Commit

Permalink
Change config for API
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuSchl committed Oct 21, 2023
1 parent eeb4d66 commit c82c638
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 26 deletions.
6 changes: 1 addition & 5 deletions front/cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ module.exports = defineConfig({
},
},
env: {
API: process.env.API
? process.env.API.split("")[process.env.API.length - 1] === "/"
? process.env.API.substring(0, process.env.API.length - 1)
: process.env.API
: "http://localhost:5000",
API: "http://localhost:5000/",
BASE_PATH: process.env.BASE_PATH
? process.env.BASE_PATH.split("")[0] === "/"
? process.env.BASE_PATH.substring(1, process.env.BASE_PATH.length)
Expand Down
5 changes: 1 addition & 4 deletions front/cypress/e2e/pages/403.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ describe("Page 403", () => {
cy.get(".login-button", {
timeout: 10000,
}).should("be.visible");
cy.location("href").should(
"eq",
"http://localhost:3000/" + Cypress.env().BASE_PATH + "/auth"
);
cy.location("href").should("eq", "http://localhost:3000/auth");
});
});
5 changes: 1 addition & 4 deletions front/cypress/e2e/pages/404.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ describe("Page 404", () => {
cy.get(".login-button", {
timeout: 10000,
}).should("be.visible");
cy.location("href").should(
"eq",
"http://localhost:3000/" + Cypress.env().BASE_PATH + "/auth"
);
cy.location("href").should("eq", "http://localhost:3000/auth");
});
});
10 changes: 2 additions & 8 deletions front/cypress/e2e/pages/randomPath.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@

describe("Page random", () => {
beforeEach(() => {
cy.visit(
"http://localhost:3000/" + Cypress.env().BASE_PATH + "/pageRandom",
{ failOnStatusCode: false }
);
cy.visit("http://localhost:3000/" + Cypress.env().BASE_PATH + "/pageRandom", { failOnStatusCode: false });
});

it("Go back to auth", () => {
cy.get(".back-button").first().click();
cy.get(".login-button", {
timeout: 10000,
}).should("be.visible");
cy.location("href").should(
"eq",
"http://localhost:3000/" + Cypress.env().BASE_PATH + "/auth"
);
cy.location("href").should("eq", "http://localhost:3000/auth");
});
});
6 changes: 1 addition & 5 deletions front/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ module.exports = {
reactStrictMode: true,
basePath: process.env.BASE_PATH ? process.env.BASE_PATH : "",
env: {
API: process.env.API
? process.env.API.split("")[process.env.API.length - 1] === "/"
? process.env.API.substring(0, process.env.API.length - 1)
: process.env.API
: "http://localhost:5000",
API: process.env.API,
BASE_PATH: process.env.BASE_PATH ? process.env.BASE_PATH : "",
IS_TEST_MODE: process.env.IS_TEST_MODE ? process.env.IS_TEST_MODE : "false",
},
Expand Down

0 comments on commit c82c638

Please sign in to comment.