Files
fristydev/components/game-profile-sections.test.tsx
T
fristy ed149ded52
CI / Code Health (pull_request) Successful in 24s
CI / Lint, Test & Build (pull_request) Successful in 59s
fix: prettier formatting and downgrade upload-artifact to v3 for Gitea
2026-09-12 00:47:38 +03:00

64 lines
2.0 KiB
TypeScript

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();
});
});