import assert from "node:assert/strict"; import { access, readFile } from "node:fs/promises"; import test from "node:test"; test("builds the KOC LOOP product shell", async () => { const [page, adminApp, layout] = await Promise.all([ readFile(new URL("../app/page.tsx", import.meta.url), "utf8"), readFile(new URL("../app/admin-app.tsx", import.meta.url), "utf8"), readFile(new URL("../app/layout.tsx", import.meta.url), "utf8"), ]); assert.match(page, /getUserFromCookieHeader/); assert.match(page, /redirect\("\/login"\)/); assert.match(page, /currentUser=\{user\}/); assert.match(adminApp, /KOC LOOP/); assert.match(adminApp, /内容分发闭环/); assert.match(adminApp, /分发工作台/); assert.match(adminApp, /formatShanghaiToday/); assert.doesNotMatch(adminApp, /7月27日/); assert.match(adminApp, /获取KOC领取链接/); assert.match(layout, /KOC LOOP|内容分发闭环/); assert.doesNotMatch(adminApp, /codex-preview|Your site is taking shape/); await access(new URL("../.next/standalone/server.js", import.meta.url)); await access(new URL("../.next/static", import.meta.url)); }); test("keeps distribution filters as always-visible fuzzy search fields", async () => { const [adminApp, globalCss] = await Promise.all([ readFile(new URL("../app/admin-app.tsx", import.meta.url), "utf8"), readFile(new URL("../app/globals.css", import.meta.url), "utf8"), ]); assert.match(globalCss, /\.distribution-task-search\s*\{[^}]*flex-direction:\s*row/s); assert.match(globalCss, /\.distribution-task-search\s*\{[^}]*margin:\s*0/s); assert.match(globalCss, /\.distribution-task-search\s*>\s*span\s*\{[^}]*flex:\s*0\s+0\s+18px/s); assert.match(globalCss, /\.distribution-task-filter-combobox\.brand\s*\{[^}]*flex-basis:\s*176px/s); assert.match(globalCss, /\.distribution-task-filter-menu\s*\{[^}]*position:\s*absolute[^}]*z-index:\s*60/s); assert.match(globalCss, /\.distribution-task-filter-input\s*\{[^}]*display:\s*flex[^}]*margin:\s*0/s); assert.match(adminApp, /aria-expanded=\{openTaskFilter === filter\.key\}/); assert.match(adminApp, /role="combobox"/); assert.match(adminApp, /role="listbox"/); assert.match(adminApp, /placeholder=\{`搜索\$\{filter\.label\}`\}/); assert.match(adminApp, /setTaskFilterValue\(filter\.key, event\.target\.value\)/); assert.doesNotMatch(adminApp, /distribution-task-filter-trigger/); assert.doesNotMatch(adminApp, /distribution-task-filter-menu-search/); assert.doesNotMatch(adminApp, /taskFilterQuery/); assert.doesNotMatch(adminApp, /distribution-task-option-panel/); assert.doesNotMatch(adminApp, /