Skip to content

Commit

Permalink
test: fix twitter/x test
Browse files Browse the repository at this point in the history
  • Loading branch information
arpitdalal committed Oct 8, 2024
1 parent 98a9d40 commit 4a3a9de
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const URLS = {
},
github: "https://github.com/arpitdalal/",
linkedin: "https://linkedin.com/in/arpitdalal/",
twitter: "https://twitter.com/arpitdalal_dev/",
x: "https://x.com/arpitdalal_dev/",
youtube: "https://youtube.com/@arpitdalal_dev/",
mail: "mailto:[email protected]",
xman: "https://xman.arpitdalal.dev/",
Expand All @@ -93,8 +93,8 @@ function githubHandler(req, res, pathToRemove) {
function linkedinHandler(res) {
res.redirect(URLS.linkedin);
}
function twitterHandler(res) {
res.redirect(URLS.twitter);
function xHandler(res) {
res.redirect(URLS.x);
}
function youtubeHandler(res) {
res.redirect(URLS.youtube);
Expand Down Expand Up @@ -129,10 +129,10 @@ app.get("/linkedin/:path(*)?", (_, res) => {
});

app.get("/x/:path(*)?", (_, res) => {
twitterHandler(res);
xHandler(res);
});
app.get("/twitter/:path(*)?", (_, res) => {
twitterHandler(res);
xHandler(res);
});

app.get("/yt/:path(*)?", (_, res) => {
Expand Down
8 changes: 4 additions & 4 deletions tests/twitter.test.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import { test, expect } from "@playwright/test";

test('"/twitter" redirects to "twitter.com/arpitdalal_dev" without utm params', async ({
test('"/twitter" redirects to "x.com/arpitdalal_dev" without utm params', async ({
page,
}) => {
await page.goto("/twitter");

// have to check if the url contains twitter and my username because
// twitter redirects to the login page if the user is not logged in
expect(page.url()).toContain("twitter");
expect(page.url()).toContain("x");
expect(page.url()).toContain("arpitdalal_dev");
});
test('"/x" redirects to "twitter.com/arpitdalal_dev" without utm params', async ({
test('"/x" redirects to "x.com/arpitdalal_dev" without utm params', async ({
page,
}) => {
await page.goto("/x");

// have to check if the url contains twitter and my username because
// twitter redirects to the login page if the user is not logged in
expect(page.url()).toContain("twitter");
expect(page.url()).toContain("x");
expect(page.url()).toContain("arpitdalal_dev");
});

0 comments on commit 4a3a9de

Please sign in to comment.