Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: improve blacklisted username error by adding secondary message #3444

Merged
merged 1 commit into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export default async (req, res) => {

if (blacklist.includes(username)) {
return res.send(
renderError("Something went wrong", "", {
renderError("Something went wrong", "This username is blacklisted", {
title_color,
text_color,
bg_color,
Expand Down
2 changes: 1 addition & 1 deletion api/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default async (req, res) => {

if (blacklist.includes(username)) {
return res.send(
renderError("Something went wrong", "", {
renderError("Something went wrong", "This username is blacklisted", {
title_color,
text_color,
bg_color,
Expand Down
2 changes: 1 addition & 1 deletion api/top-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default async (req, res) => {

if (blacklist.includes(username)) {
return res.send(
renderError("Something went wrong", "", {
renderError("Something went wrong", "This username is blacklisted", {
title_color,
text_color,
bg_color,
Expand Down
4 changes: 3 additions & 1 deletion tests/api.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,9 @@ describe("Test /api/", () => {
await api(req, res);

expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
expect(res.send).toBeCalledWith(
renderError("Something went wrong", "This username is blacklisted"),
);
});

it("should render error card when wrong locale is provided", async () => {
Expand Down
4 changes: 3 additions & 1 deletion tests/pin.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ describe("Test /api/pin", () => {
await pin(req, res);

expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
expect(res.send).toBeCalledWith(
renderError("Something went wrong", "This username is blacklisted"),
);
});

it("should render error card if wrong locale provided", async () => {
Expand Down
4 changes: 3 additions & 1 deletion tests/top-langs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ describe("Test /api/top-langs", () => {
await topLangs(req, res);

expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
expect(res.send).toBeCalledWith(renderError("Something went wrong"));
expect(res.send).toBeCalledWith(
renderError("Something went wrong", "This username is blacklisted"),
);
});

it("should render error card if wrong locale provided", async () => {
Expand Down