dashboard/tests/unit
The suite covers the Next.js dashboard's pages, components, route handlers and lib/ helpers. It
runs under vitest with @testing-library/react and @testing-library/jest-dom in happy-dom, with
TZ=UTC set by vitest.config.ts. Every test mocks fetch, so the suite needs no browser, container or network.
cd dashboard
npm test # vitest run
npm run test:watch
npm test -- settings-page # one file
Dashboard internals owns the behaviour these tests guard, and gives the full reason behind each trap below. happy-dom does no layout, so widths, wrapping and breakpoints are tested in the end-to-end suite.
Two rules recur across the entries:
- An untouched picker (one nobody has changed) does not send a value the page worked out (What each approval sends).
- A metric nobody reported renders as a dash, because "not reported" and "reported as zero" are different claims.
Pages
pipeline-client.test.tsx
Covers components/PipelineClient.tsx, the root of
the pipeline board.
- Loading and 5-second polling. A stale response that arrives after a newer one is dropped.
- The voice roster, the OpenAI-key state and the agents reach
ActionPane. - The Nothing can render banner shows when videos are queued and no renderer can take one,
including when the only online renderer's credential has expired. It stays down when
/rendererscannot be read.
library-page.test.tsx
Covers app/library/page.tsx.
- Loading, polling, and a search over both the short title and the full topic.
- Delete and Request Revision from the video window reach the API, and a refused action is reported.
publishingEnabledcomes from/settingsand is off until that answers and after a failed read.
Trap: the page filters statuses in the browser, so a status missing from its list does not appear.
One case guards PARTIALLY_PUBLISHED, which is listed under its own Partially published state.
Trap: the Library lists the videos that Publish…, Retry publishing and Cancel schedule apply to, so the video window needs the publishing flag here.
projects-page.test.tsx
Covers app/projects/page.tsx: the domain list, the videos of the selected domain, polling and
dates in the host timezone. The active or paused badge appears on a curriculum seed only, because
no other domain can be paused. The expired badge appears on any domain at its topic cap.
projects-page-action-extra.test.tsx
Covers the Projects page's own action dispatcher (Actions).
- The picks the video window passes as the action's
extraargument travel in the samePATCHas the status change. - The page hands the video window the voice roster and
publishingEnabledfrom/settings.
Trap: a dispatcher that drops extra still renders the pickers and the request still succeeds, so
the picks are lost with no error. The API freezes them at approval, so they cannot be applied later.
projects-page-agent-picker.test.tsx
Covers the Projects page with the real VideoModal, on the path where nobody touches the agent
picker. Approving a topic sends no agent_id and approving a script sends no agent field, before
and after /agents answers. A picked agent does reach the PATCH.
Trap: a test that always picks an agent cannot catch a page that submits a guessed agent as an explicit value.
topics-page.test.tsx
Covers app/topics/page.tsx, the Topics page.
- Mining sources: a refused save shows the API's message, and a successful save lists what the API
stored. The Mining toggle is disabled while the API reports
mining_available: false. - The pause control appears on a curriculum seed only, labelled "Pause topic generation".
- The default pickers on a domain row and in the add form (visual style, voice, script profile, mascot) are found by their captions. A default that has left the roster or the profile list stays visible as removed or unavailable.
- The mascot default offers "Use install default", "None" and each pickable mascot. Mascots are disabled with the reason unless the GPU is working, and while the GPU status has not loaded.
- The topic cap field saves on blur and reverts an invalid entry. EXPIRED shows on any domain at its cap, and an expired seed hides ACTIVE and keeps PAUSED.
- The add form's description keeps interior newlines and stops at 2000 code points.
Trap: POST /projects replaces the whole row, so every edit
re-sends every field. A field left out is reset by that edit: an omitted default_mascot_id returns
the domain to the install default, and an omitted topic_cap resets the cap to 100.
Trap: after a cap edit, the count and the expired state come from the row the API returns. The count the page loaded can be stale, because research may have filed a topic in between.
new-video-page.test.tsx
Covers the request body of the New Video page.
- Untouched pickers send no
agent_idand""foragent_modelandagent_effort. A picked agent pins its default model. - The voice picker's Default names the voice the API will give the video.
- Submit is blocked with a title over 70 code points, and a refusal keeps the input.
script-profiles-page.test.tsx
Covers app/script-profiles/page.tsx: the list with each status, the create form (a name and one
URL per line, both required), a FAILED profile's stored error and delete after a confirm.
Selecting a row fetches the full row, because the list omits the markdown.
mascots.test.tsx
Covers app/mascots/page.tsx.
- The create form sends a name and description, or
surprise: truealone for Surprise me. - An
IN_REVIEWmascot shows its draft and approved sheets through/mascot-sheets/…. Approve sends no body, and Request changes needs a comment. - The review actions follow the status. A built-in offers Ask for a variation (
based_on) in place of Request changes, and an archived mascot offers nothing.
Trap: Archive is disabled while another action on the mascot is in flight, and that action's buttons are disabled during an archive, because the two requests race at the API.
profiles-nav.test.tsx
Covers components/ProfilesNav.tsx, the sub-nav on the Script Profiles and Mascots pages: both
links render and the current page is marked. The two pages share one top-bar tab, because another
tab does not fit the bar's one-row layout.
settings-page.test.tsx
Covers app/settings/page.tsx, the settings page.
- Staged saving: SAVE sends only the edited field, and switching tabs with unsaved edits asks first. The pause switch applies at once.
- Each tab saves only its own keys, with its bounds and units (timeouts shown in minutes and stored in seconds).
- An API key renders as the mask the server returned. Clearing the field posts an empty string.
- Voice: each roster row picks its own model, and a save carries the roster with no
elevenlabs_model_idorpronunciation_modekey. - Agents: the default, weight, default model and effort each
PATCHat once, and the tab issues noDELETE. - The Rendering tab's default-mascot picker lists only pickable mascots and saves
default_mascot_idalone. Mascots are disabled with the reason while the GPU is not working, and "No mascot" and a held value stay selectable. The same tab shows the Renderers panel. - The Retention tab's backlog line is left out when
/retention/backlogfails, and the field stays usable.
Trap: the Discord webhook URL is the credential, because anyone who holds it can post to the channel. Its input stays a masked field on the Notifications tab, off the API keys tab.
Trap: the effort select stays usable for an agent with an empty models list. The effort levels
come from the CLI, so a broken model list must not remove the effort control.
renderers-panel.test.tsx
Covers components/RenderersPanel.tsx (Renderers).
- One card per renderer, the built-in one first, with its status chip, GPU verdict and the device Chromium got.
- Each button sends its request, and an API refusal shows on that renderer's card.
- The panel polls every 3 seconds while a GPU test is outstanding and every 20 seconds otherwise.
- Add renderer shows the token and the host command once and forgets both on close.
- A response of the wrong shape is not drawn as a renderer list.
Trap: the host command in the dialog does not contain the token. The script asks for it, which keeps the token out of the renderer machine's process list and shell history.
costs-panel.test.tsx
Covers components/CostsPanel.tsx, the settings page's Costs tab. Each model names the source of
its rate or says it has none, the last successful sync and a failed sync are both shown, and only a
manual rate offers Reset.
Trap: a price is typed per million tokens and sent per token.
auto-pilot-panel.test.tsx
Covers components/AutoPilotPanel.tsx and lib/autoPilot.ts
(Auto Pilot).
- The whole warning is always on screen.
- A save that widens what Auto Pilot acts on opens a confirmation that names how many videos are approved at once, and nothing is sent until it is confirmed.
- Only accounts that are allowed and connected are offered.
- The gap shows in hours and is sent in minutes. At the in-progress limit the tab says why nothing new starts.
Trap: a response that is not a configuration (a proxy error, another suite's fetch mock) must not render as "off, no domains", because a SAVE on that view overwrites the real configuration.
Trap: an account chosen earlier that is not offered any more stays visible and ticked. Hidden, it could not be removed, and every save would send it again.
Trap: the periodic refresh changes only the in-progress count, so an unsaved edit survives it.
socials-page.test.tsx
Covers app/socials/page.tsx (Publishing surfaces).
- Accounts are grouped by platform, and the count reflects only the enabled ones.
- An allowlisted account that is gone upstream is flagged and can still be unticked, which is the one way to clean a stale entry out.
- Connect runs one at a time and falls back to a link when the browser blocks the tab.
Trap: saving sends account ids only. Display data is read live on every load, and a stored username would be a second copy that goes stale.
Trap: the Connect tab opens inside the click, because a popup blocker allows window.open only
then. The URL cannot be fetched ahead, because its state is single-use.
analytics-page.test.tsx
Covers app/analytics/page.tsx, the Videos tab.
- The totals count published videos, and each publication has its own row.
- Platform and account filters go to the API, from the menus and from a clicked graph bar.
- An unreported metric renders a dash and sorts below a real 0.
- When the account-name lookup fails, the page shows the id with the platform and still filters.
- The table renders 50 rows and adds 50 when its end comes into view of the table's own scroll box.
A browser with no
IntersectionObservergets every row.
analytics-charts.test.tsx
Covers components/AnalyticsCharts.tsx. Bars run highest first, scaled against the largest.
Clicking a bar sets the filter and clicking the selected bar clears it. A month where views fell
keeps its negative figure and draws no height.
Trap: an entry with nothing reported comes last as a dash with no bar. An empty bar would claim that nobody watched.
spend-card.test.tsx
Covers components/SpendCard.tsx, the Analytics page's Spend tab.
- Unpriced calls are called out beside the total. The ElevenLabs pool shows when the key can read it, labelled as the billing period, and recorded credits show otherwise.
- A backwards or half-empty custom range is flagged and not sent, and the previous range's figures are hidden.
Trap: a preset is sent by name, and the label shows the days the API returns. The card sends no
dates of the browser's own, because TimeZoneProvider is UTC until the host zone arrives
(Time).
archive-page.test.tsx
Covers app/archive/page.tsx. The page asks the API for archived videos only and lists them most
recently archived first. A deleted video keeps its publication links and its views summed across
platforms, which is how analytics outlive the files.
logs-page.test.tsx
Covers app/logs/page.tsx. Records render in the order the API returned them, the service and
level options come from the response, the filters go on the query string and refresh is on demand
with no polling.
Trap: an API error shows as an error. Rendered as an empty list, it would read as "no logs".
Components
action-pane.test.tsx
Covers components/ActionPane.tsx, Quick Actions, and the
pickers on its rows.
- Rows are grouped by status in pipeline order, and a pill hides its group. With every status filtered out the pane says no actions match and keeps the pills.
- Voice: a voice in
voice_conflictsis disabled with the reason, and a voice that left the roster is listed as itself, disabled. - Script profile: a held profile that is not offered stays visible and can be cleared.
- Agent, model and effort: a changed agent
swaps in its own models, and all three are greyed while no agent can run the video. An untouched
approval sends
""for the effort. - Visual style: a video left on Auto shows the style the agent chose, marked automatic. A page that passes no key state leaves Illustrated enabled.
- Mascot: the picker is hidden when nothing can be picked.
Mascots are disabled with the reason unless the GPU is working, and while the GPU status has not
loaded.
mascot_idtravels withapprove-topiconly when the picker shows. Choosing Cartoon 3D clears and locks the picker and sends an empty mascot. - A refused approval (
onActionresolvingfalse) brings the row back so the pick can be changed. - Every picker is found by its caption (
getByLabelText), which proves the caption is the control's accessible name.
Trap: a picker's shown value is recomputed on every render. A value captured at mount shows one
voice and sends another when /settings answers late.
Trap: at TOPIC_PROPOSED an untouched approval sends no voice_id. Sending the shown voice pins
the install default over the voice the video got from its domain.
Trap: an untouched mascot picker re-sends a held, still-pickable mascot, even with the GPU not usable. Stripping it would remove the mascot from a video nobody edited.
video-modal.test.tsx
Covers components/VideoModal.tsx, the video window.
- Reject Topic fires at once. Request Revision opens the dialog, posts the comment and then fires the revise action.
- The Script tab renders segmented and legacy flat scripts, and shows pronunciation and pause markup as the authored words.
- The Video tab plays
/stream/<project_id>/<id>.mp4whatevervideo_pathholds. - The Actions block carries the same pickers as a Quick Actions row, under the same rules. The
mascot cases cover its caption, the GPU gate, the
approve-topicpayload and the Cartoon 3D lock. - Once the pickers are gone, their values show read-only. The Voice and Voice model rows come from
voice_infoand are hidden while the voice picker is up. - A scheduled video says when it goes out, in the zone it was picked in. Cancel schedule calls the API after a confirm, and the window offers no Delete.
Trap: the component stays mounted between videos. A pick made for one video (agent, effort, voice) must be forgotten when another opens, or the second video's approval writes it.
Trap: the picker label cases are scoped to the Actions block, because a read-only row elsewhere in the window carries the same caption.
Trap: publishingEnabled defaults to off, so a page that does not fetch settings cannot publish.
video-modal-delete.test.tsx
Covers the video window's Delete action: it is offered at the deletable statuses only, fires once after a confirm and deletes nothing on cancel. An archived video shows the Archived badge.
video-modal-retry-agent.test.tsx
Covers Retry agent, lib/videoStatus.ts::isAgentStuck and the board card's STUCK tag. The
control is offered for a stuck video that is not archived, posts to agent-retry and refetches the
video.
Trap: a stuck video sits at an agent status, where the window otherwise shows no Actions block, so the block's own condition must admit a stuck video.
video-modal-retry-publish.test.tsx
Covers Retry publishing and lib/videoStatus.ts::canRetryPublish
(POST /videos/<id>/publish/retry).
- The control is offered for a
FAILEDvideo that has publication rows. It is not offered for a failed render, an archived video or an install with publishing off. - It refreshes in place when the server adopted a live post, and opens the Publish dialog when nothing was live.
video-modal-mark-published.test.tsx
Covers Mark as published, lib/videoStatus.ts::canMarkPublished and the window's handling of
late responses (A partial publish).
- The control is offered at
PARTIALLY_PUBLISHEDonly, with publishing switched off too, because it is the only way out of that status. - Confirming sends a
PATCHguarded byonlyIfCurrentStatus. - Only the newest response for the video on screen lands, and a failed refresh clears the rows.
Trap: confirming hands the video to retention, which dates from the first successful post, so a
partial publish older than retention_days loses its file on the next pass. The dialog carries a
download link, and Confirm stays disabled until the publication rows have loaded.
Trap: without the numbering of refreshes, a retry that finishes after the next video opened swaps the window back to the old video.
publish-dialog.test.tsx
Covers components/PublishDialog.tsx.
- The dialog offers only allowlisted, still-connected accounts and refuses to publish with no target or an empty title.
- It prefills the title and description the agent wrote, and opens on the video's own title when that call fails.
- Scheduling: the timezone defaults to the browser's, and nothing is sent until a date and a time are picked.
Trap: publishing cannot be undone. No account is ticked in advance, and on reopen the dialog drops the previous video's selection, metadata and schedule.
Trap: the body carries the wall time and the zone, and the API converts (Scheduling a post). The dialog sends no UTC instant, because the API owns daylight saving.
Needs: a zone named as the browser's CLDR list names it. The scheduling case uses Asia/Calcutta,
which the tz database calls Asia/Kolkata.
revise-dialog.test.tsx
Covers components/ReviseDialog.tsx. The dialog sets an inline width narrower than the video
window beneath it and uses a shrinkable grid column, so a long title cannot widen it. Send stays
disabled until there is non-blank text.
cost-breakdown.test.tsx
Covers components/CostBreakdown.tsx, the video window's cost card
(Components). ElevenLabs shows as credits, unpriced calls are
counted and not shown as $0, and a video with no recorded usage says so.
Trap: a shared agent session shows this video's share beside the whole session, and the total adds the share. Adding whole sessions counts one session once for every video in its batch.
Trap: the Agent row case asserts one element per model name and its nowrap, because happy-dom
cannot see a wrapped line. A joined string breaks after a hyphen in the narrow sidebar.
kanban-board.test.tsx
Covers components/KanbanBoard.tsx column placement. PARTIALLY_PUBLISHED has no column of its
own and is folded into Published through extraStatuses. A status with neither does not appear on
the board.
kanban-card.test.tsx
Covers components/KanbanCard.tsx and lib/utils.ts::scoreLabel.
- The display name is the short title and falls back to the topic.
- An unscored video (score 0, which only the New Video page creates) reads as a dash.
- Only a
SCHEDULEDcard shows a post time, in the zone it was picked in. - A
PARTIALLY_PUBLISHEDcard is tagged PARTIAL, because it shares the Published column.
summary-strip.test.tsx
Covers components/SummaryStrip.tsx. In Pipeline sums the eight in-flight statuses, SCHEDULED
included, and leaves out the checkpoint statuses. Published counts PARTIALLY_PUBLISHED too.
mining-sources.test.tsx
Covers components/MiningSources.tsx and canonicalYouTubeUrl, the panel's copy of the API's URL
rule (Mining sources). The accepted forms come back as
https://www.youtube.com/watch?v=<id>, and Add does not add a second spelling of a listed
video.
Trap: the rule is copied so that the button lights only for what the API will store. The API still validates.
voice-preview-button.test.tsx
Covers components/VoicePreviewButton.tsx.
- A second click replays the cached sample without a fetch. One button shows play or pause and follows the audio's own events.
- A change of voice or model fetches a new sample, and a slow response for a model that is not selected any more is dropped.
- A model is sent in a JSON body with its
Content-Type, because the proxy refuses a body without one.
timezone-provider.test.tsx
Covers components/TimeZoneProvider.tsx (Time). A valid IANA zone and
label are accepted. A missing field, a human label in the zone slot, a non-ok response and a
rejected fetch each degrade to UTC.
topbar-version.test.tsx
Covers the top bar's version badge. It shows the version the API reports and renders nothing when the version is unavailable. It is polled, so it picks up a new version after an upgrade and drops the version while the API is down.
Trap: a wrong version in a bug report is worse than none, so the badge has no fallback text.
Needs: the disk-usage figure fetches first, so the sequenced mocks answer /storage separately
(besideDiskUsage).
disk-usage.test.tsx
Covers components/DiskUsage.tsx (Disk usage).
- The popup says "not measured yet" without a host snapshot and "unknown" for a figure Docker could not give.
- With two or more old images, the old-image line and both totals carry "≥".
- The component renders nothing on a
404, another body shape or a network error, because a wrong figure misleads more than none.
update-banner.test.tsx
Covers components/UpdateBanner.tsx (Update check).
- The banner names both versions and links the release and the upgrade guide with
noopener. It renders nothing for no update, a failed request or a link that is nothttps://, and does not check on/login. - ✕ hides that version for later page loads, and a newer version brings the banner back. When storage throws, the dismissal lasts for the page.
Routes and helpers
proxy-route.test.ts
Covers app/api/proxy/[...path]/route.ts,
the route every dashboard API call goes through.
- Without a valid session the answer is
401and Flask is not called. Every upstream call carries the API token. - Responses are not cached.
- A
POSTorDELETEwhoseSec-Fetch-Siteis notsame-originis a403, and a body that is not JSON is a415. A missing header, anyGETand a bodilessPOSTpass.
Trap: a 401 from Flask becomes a 502 that names the fix. Relayed as a 401, it sends the
browser to /login in a loop.
Trap: the query string must reach Flask. A dropped ?status=PUBLISHED returns every video, which
looks like a fault in the page.
Trap: an empty form POST is a 415, because a form always sends a Content-Type. The guard
exists because SameSite=Strict does not stop a page on another port or a sibling subdomain
(Cross-site request forgery).
stream-route.test.ts
Covers app/stream/[...path]/route.ts, on a
real temporary directory tree with only the session mocked.
- Access: no session is a
401before the filesystem is touched. A..escape, a symlink that leads outside the root, a directory, a FIFO and any extension other than.mp4and.mp3are each a404. - A directory swapped for a symlink between
realpathandopenis a404, by the descriptor's/proc/self/fdpath on Linux and by device and inode withprocess.platformset todarwin. - The file handle is closed on an abort, a cancelled body and a
304. - The body is a stream. Single ranges, invalid ranges,
If-None-MatchandIf-Rangefollow the route's rules.
Trap: the filesystem is real because the defects are filesystem behaviour (a symlink followed by
open, a FIFO that blocks it), which a mocked fs cannot show.
Trap: O_NOFOLLOW guards only the last path component, so the descriptor check is what refuses a
swapped directory. The swap runs inside a wrapped open() so that the race is deterministic.
Trap: an ETag built from size and mtime alone survives a same-size re-render with its mtime
restored, and the browser replays the old video.
Needs: mkfifo on the path, and a filesystem with symlinks.
mascot-sheets-route.test.ts
Covers app/mascot-sheets/[...path]/route.ts,
the authenticated image relay.
- No session is a
401, and Flask is not asked. - Only
<id>/versions/<n>/sheets/<turn|feels|act>is served, and any other path is a404before Flask is asked. Ids follow the PythonMASCOT_ID_RE, underscores included. - Only
image/pngandimage/jpegare relayed. A401from Flask is a502, so the browser is not sent to/login.
auth-routes.test.ts
Covers the login and logout routes (Signing in), on the real
next/server.
- The password goes to Flask with the API token, and only a
200sets the cookie. The backoff passes through as429with itsRetry-After. - Both routes refuse a request that is not
same-originwith403and a non-JSON body with415.
Trap: Flask refusing the dashboard's token (unauthorized) is a 502. Shown as a wrong password,
it would hide a broken install behind a login error.
middleware.test.ts
Covers middleware.ts. A page load with no session cookie is redirected to /login with its path
and query in next, and a request with the cookie passes.
Trap: the middleware checks only that the cookie is present, and the proxy, stream and mascot-sheet
routes verify the signature. The matcher leaves out the API routes, /stream, /mascot-sheets,
Next's assets and /login, so that a fetch(), a <video> or an <img> gets a 401 from its
route and never the login page's HTML.
session.test.ts
Covers lib/session.ts and lib/sessionCookie.ts.
- A forged, expired or
alg: nonetoken does not verify, and a missingsession_secretfails closed. - Rotating
session_secretsigns every browser out, which is how--set-passworddoes it. Both secrets are read on every call, so a rotation needs no restart. safeNextkeeps the post-login redirect same-site.
Trap: the cookie is Secure only when the browser came over HTTPS. Always Secure, it would make
sign-in over plain HTTP on a LAN impossible.
update-check-route.test.ts
Covers app/api/update-check/route.ts (Update check).
- Without a session the answer is
401, and neither the API nor GitHub is called. develop, an API that sends nogithub_repoand a malformed repository never reach GitHub. An unreachable API or GitHub answers "no update".
Trap: the installed version is read on every request while GitHub's list stays cached, so the banner clears as soon as an upgrade lands.
update-check-lib.test.ts
Covers lib/updateCheck.ts, the update check's decision layer.
- Only a newer stable release is offered. Versions compare by SemVer precedence, so an install on
2.1.0-rc.1is offered2.1.0, anddevelopis offered nothing. isRepoaccepts only a bareowner/name, because the value goes into a URL.- GitHub's list is asked at most once in 2 hours, and a failure keeps the last good list and is
retried after 15 minutes. The request carries a
User-Agent, which GitHub requires.
Trap: the newest release is chosen by version. GitHub lists by creation date, so a later patch to an older line comes first in the list.
Trap: a prerelease is recognised by its tag as well as by GitHub's flag, because a release can be published without the flag.
agents-lib.test.ts
Covers lib/agents.ts, the rules ActionPane and VideoModal share
(Agent, model and effort pickers).
agentOptionsoffers only live agents and shows a video's own uninstalled agent disabled.- A changed agent carries its own default model and never a model from the previous agent's list.
Trap: only topicApprovalPayload pins a model. On every other action agentPicksPayload sends
only what was touched, whether or not the agent list loaded, so a slow GET /agents cannot move a
video to another agent.
voices-lib.test.ts
Covers lib/voices.ts (Voice picker). topicVoicePayload
carries a voice only when one was picked. shownVoice is the pick, else the video's own voice, else
the install default. voiceMissing detects a voice with no roster entry, so the picker can list it.
visual-styles.test.ts
Covers lib/visualStyles.ts (Visual-style picker).
illustratedAvailablereads the maskedopenai_api_key, where""means unset, so the key never reaches the browser.cartoon3dAvailableis true only while the GPU probe says working, andstyleOptionstells an untested GPU apart from a missing one.videoStyleLabelnames the world an Auto video settled on.
Trap: settings and GPU status that have not loaded count as available, so the API gives the refusal and a page that loads neither does not grey an option out wrongly.
mascots-lib.test.ts
Covers lib/mascots.ts (Mascot picker).
mascotGateis open only while the GPU is working.mascotOptionskeeps a held mascot that is still pickable selectable. One that is not pickable shows as unavailable and is never read as None.approvalMascotsends no mascot for Cartoon 3D.
Trap: the gate fails closed while the GPU status has not loaded, the opposite of the visual-style rule. An untouched picker could otherwise send a mascot the API refuses.
renderers-lib.test.ts
Covers lib/renderers.ts, the rules behind the Renderers panel and the board's banner
(Renderers).
rendererStatuslets the first thing that stops a renderer taking work win: disabled, then credential expired, then needs upgrade, then offline.- The GPU verdict is read from the renderer's probe only.
nothingCanRenderis raised when a video is queued and no renderer is enabled, online, on this version and holding an unexpired credential. A busy renderer still counts.
Trap: nothingCanRender judges credential expiry by the same rule and the same now as the status
chip, so a card that says credential expired cannot keep the banner down.
video-status.test.ts
Covers lib/videoStatus.ts: canDelete, deleteVideo and patchVideo. An archived video is
refused at any status, and patchVideo names a lost status race as a conflict and passes any other
refusal on in the API's words.
Trap: DELETABLE_STATUSES is asserted equal to the full allowed set, with no status missing or
extra, because the set is copied from the API
(Copied constants).
video-modal-utils.test.ts
Covers the two /stream URL builders in lib/utils.ts. videoStreamUrl builds a render's URL
from the video's own domain id and video id, each encoded as one path segment, under default_proj
when there is no domain (where the render gateway stores the file). videoToStreamUrl rewrites the
/output_videos/… path a voice preview comes back with.
Trap: videoStreamUrl never reads video_path. A row that names another video's file must not play
that file.
datetime.test.ts
Covers lib/datetime.ts (Time).
formatDate,formatDateShort,formatDateTimeandformatClockuse the zone they are given and return a dash for unparseable input.- A timestamp stored with no zone designator is read as UTC.
- The scheduling helpers
formatScheduled,wallClockandaddDays.
Trap: the suite runs with TZ=UTC and asserts a non-UTC zone in the same file, which proves the
explicit timeZone argument does the work and no host default does.
palette-contrast.test.ts
Covers the secondary text tokens in app/globals.css. The test parses the stylesheet and computes
WCAG contrast ratios.
--dimand--muteeach clear AA (4.5:1) on--bg,--paneland--panel-2.- The order
ink > ink-2 > dim > muteholds, so secondary text cannot be brightened until it competes with primary text. - Every
--muted-foregrounddeclaration isvar(--dim), so the shadcn token cannot drift from the palette.
Trap: the secondary tokens are used at 10 and 11px, where contrast matters most.