Skip to content

Commit

Permalink
refactor: replace route /rastreamento to /rastreador
Browse files Browse the repository at this point in the history
  • Loading branch information
jonataspinto committed Oct 30, 2023
1 parent ba62b94 commit fc53d31
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Live at:

https://challenge-tracker-frontend.vercel.app/rastreamento
https://challenge-tracker-frontend.vercel.app/rastreador

Códigos de ratreio dos pedidos mocados.
| ID | Status |
Expand Down
11 changes: 4 additions & 7 deletions cypress/e2e/tracking.cy.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe("Traking", () => {
it("Should render an error message when clicks in submit button without tracking code.", () => {
cy.visit("http://localhost:3000/rastreamento");
cy.visit("http://localhost:3000/rastreador");

cy.get('button[type="submit"]').click();

cy.get(".Mui-error").should("contain", "Digite um código válido");
});

it("Should render an error message when send an invalid tracking code.", () => {
cy.visit("http://localhost:3000/rastreamento");
cy.visit("http://localhost:3000/rastreador");

cy.get('input[name="trackCode"]').type("BBBBBB");

Expand All @@ -23,18 +23,15 @@ describe("Traking", () => {
});

it("Should navigate to tracking details when inserts a valid tracking code", () => {
cy.visit("http://localhost:3000/rastreamento");
cy.visit("http://localhost:3000/rastreador");

cy.get('input[name="trackCode"]').type("EFGH67890");

cy.get('button[type="submit"]').click();

cy.wait(4000);

cy.url().should(
"eq",
`http://localhost:3000/rastreamento/789012/EFGH67890`
);
cy.url().should("eq", `http://localhost:3000/rastreador/789012/EFGH67890`);

cy.wait(4000);

Expand Down
6 changes: 3 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const nextConfig = {
async rewrites() {
return [
{
source: "/rastreamento",
source: "/rastreador",
destination: "/tracker",
},
{
source: "/rastreamento/:slug*",
source: "/rastreador/:slug*",
destination: "/tracker/:slug*",
},
];
Expand All @@ -23,7 +23,7 @@ const nextConfig = {
return [
{
source: "/",
destination: "/rastreamento",
destination: "/rastreador",
permanent: true,
},
];
Expand Down
2 changes: 1 addition & 1 deletion src/_mock/lang/pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export default {
},
{
title: "Acompanhe seu pedido",
slug: "/rastreamento",
slug: "/rastreador",
},
],
authLinks: [
Expand Down
2 changes: 1 addition & 1 deletion src/components/TrackerForm/useTrackerForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function useTrackerForm(): UseTrackerForm {

const { orderNumber, trackingNumber } = await response.json();

router.push(`/rastreamento/${orderNumber}/${trackingNumber}`);
router.push(`/rastreador/${orderNumber}/${trackingNumber}`);
})
.catch((error) => {
if (error.message.includes(404)) {
Expand Down

0 comments on commit fc53d31

Please sign in to comment.