Urgent.News

What's breaking now, across hundreds of outlets.

Tech

344 tests, 46 per cent of them about money, and the only components we ever render in a test are two pricing cards

I had never counted what our tests are for. They pass, the suite is fast, and that was enough. This week I ran everything and sorted it, because I wanted to know what PubTrivia would catch if I broke it tomorrow. The setup is plain. Vitest 4, environment: 'node' , no jsdom, no browser, no mock server. The config includes **/__tests__/**/*.test.ts and one setup file that loads .env.local . I left…

A comprehensive analysis of the extensive test suite, revealing the distribution of tests across various components and the critical role money plays in the majority of them. The suite covers 344 tests, with 46% of those focused on monetary aspects. A breakdown of the test categories includes area tests, billing and checkout, in-game helpers and rules, content registry and page metadata, free tools, and infrastructure.

Notably, 159 tests, comprising 46.2% of the total, are dedicated to money-related functionalities. The suite exclusively renders two pricing cards, using react-dom/server's renderToStaticMarkup to convert components into strings for strict validation. This test verifies the correct display of prices in different currencies, ensuring a seamless user experience.

The suite also includes tests for billing, checkout, webhooks, managed payments, in-game helpers and rules, content registry, page metadata, free tools, and infrastructure. Interestingly, the header, footer, host screen, sign-up form, tools, and other pages are not rendered in any tests. The two pricing components and three route handlers are the main elements imported from the components/ and app/ directories, respectively.

The suite's effectiveness lies in its ability to catch critical issues without rendering a browser, relying on static markup rendering and string comparisons. The only test not rendered is the database integration test, as it requires a live database connection. The suite's author suggests widening the glob to include *.test.{ts,tsx} to ensure the first component test is not ignored, and adding render tests for the footer and header navigation using the same renderToStaticMarkup method.

Despite the extensive test suite, it does not provide insights into whether any page renders, layout accuracy, or the overall exercise of code.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

More from Dev.to on urgent.news

Get the news by email. Yesterday's most-covered stories, every morning.

See today's edition · More options

More in Tech

More from Saturday, 5 December 2026 →