import assert from "node:assert/strict"; import test from "node:test"; import { renderToStaticMarkup } from "react-dom/server"; import { DramaCard, PlayRecommendationCard, SeriesCard, } from "../src/components/catalog/Cards"; import { Pagination } from "../src/components/catalog/Pagination"; import { PromoGrid } from "../src/components/catalog/Promotions"; import { CatalogGrid, ListPage, SeriesPage, } from "../src/features/catalog/BrowsePages"; import { allListURL, array, cardTags, moreListURL, moreSeriesListURL, searchResultsURL, seriesListURL, tagPageURL, topicDetailURL, } from "../src/features/catalog/model"; const item = { id: 7, slug: "都市 剧", playName: "作品名", title: "备用标题", cover: "/static/brand/header.svg", totalEpisode: 8, updateStatus: 1, isFeatured: true, tagIds: [2], tagNames: ["爱情"], tagSlugs: ["romance"], themeIds: [3], themeNames: ["爱情", "都市"], themeSlugs: ["love", "city"], }; const ads = [ { id: 1, images: "/static/brand/header.svg", link: "https://promo.test/", title: "推荐", }, ]; test("React card variants preserve watch URLs, episode gates, badges and linked deduplicated tags", () => { const card = renderToStaticMarkup(); assert.match(card, /class="hk-drama-card hk-drama-card--list"/); assert.match( card, /href="\/drama\/都市%20剧\/"|href="\/drama\/%E9%83%BD%E5%B8%82%20%E5%89%A7\/"/, ); // Episode count and serial state sit in the cover corner; the line under the title lists genres. assert.match( card, /8<\/b> 集 · 连更<\/span><\/a>/, ); assert.match( card, /

爱情<\/a>