desloppify: code health overhaul plus abuse hardening (140 green, strict 87.2)
Honest baseline after removing 45 gaming suppressions. Structural: lib/game plus root hooks extraction, CORS origin echo, DEV_ORIGINS layering. Fixes: error-cause binding, discord 5xx split, null-cache guard, co-located tests, rejecting-fetch coverage, naming and typing cleanup, socket controller, cache bound, cascade helpers, latch resets. Hardening: per-IP rate limit on API routes, deterministic-miss UX, retry cooldown plus cap. Suite 140 green, build plus lint clean.
This commit is contained in:
78 files changed
+4908
-1430
No files matched your search
@@ -0,0 +1,59 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { ModalPrices, ModalReviews } from "@/components/game-profile-sections";
|
||||
import { getDictionary } from "@/lib/i18n/get-dictionary";
|
||||
import type { GamePricePoint } from "@/lib/game/game-profile-types";
|
||||
import { profileFixture } from "@/test/fixtures";
|
||||
|
||||
describe("ModalReviews", () => {
|
||||
it("renders nothing without review sources", () => {
|
||||
const dict = getDictionary("en");
|
||||
const { container } = render(
|
||||
<ModalReviews profile={profileFixture()} dict={dict.discord.gameModal} localeTag="en-US" />,
|
||||
);
|
||||
expect(container.textContent).toBe("");
|
||||
});
|
||||
|
||||
it("renders Steam review data", () => {
|
||||
const dict = getDictionary("en");
|
||||
render(
|
||||
<ModalReviews
|
||||
profile={profileFixture({
|
||||
steamReviews: {
|
||||
label: "Positive",
|
||||
total: 100,
|
||||
positive: 90,
|
||||
negative: 10,
|
||||
url: "https://store.steampowered.com/app/100/#app_reviews_hash",
|
||||
},
|
||||
})}
|
||||
dict={dict.discord.gameModal}
|
||||
localeTag="en-US"
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText("Positive")).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("ModalPrices", () => {
|
||||
it("renders the free badge", () => {
|
||||
const dict = getDictionary("en");
|
||||
const bestPrice: GamePricePoint = {
|
||||
price: 0,
|
||||
regular: 0,
|
||||
currency: "USD",
|
||||
shop: "Steam",
|
||||
url: "",
|
||||
};
|
||||
render(
|
||||
<ModalPrices
|
||||
dict={dict.discord.gameModal}
|
||||
localeTag="en-US"
|
||||
bestPrice={bestPrice}
|
||||
historyLow={null}
|
||||
isFree
|
||||
/>,
|
||||
);
|
||||
expect(screen.getByText(dict.discord.gameModal.free)).toBeDefined();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user