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

This commit is contained in:
Alexandr Garbuzov 2023-10-30 12:31:41 +02:00 committed by GitHub
parent 9c6eb22862
commit 89fc14609e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 12 additions and 6 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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,

View File

@ -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 () => {

View File

@ -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 () => {

View File

@ -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 () => {