Astigmatism Self‑Check Chart – Online Dial & Lines
Display an astigmatism dial and instructions for self-assessment. Educational, not a medical diagnosis.
UD5 Toolkit
Generate production-ready function stubs, spies & module mocks instantly
jest.fn(), jest.spyOn(), and jest.mock() as its core mocking APIs. Vitest provides nearly identical APIs through vi.fn(), vi.spyOn(), and vi.mock(). The main difference is that Vitest is ESM-first and integrates natively with Vite, making it faster for projects already using Vite. Both support the same mock chaining methods like .mockReturnValue(), .mockImplementation(), and .mockResolvedValue().
.mockReturnValue()).expect(mockFn).toHaveBeenCalledWith(...)).jest.spyOn() when you need to watch real implementations. In practice, Jest/Vitest combine all three concepts into fn().
beforeEach to reset mock state: call mockFn.mockClear() to reset call history, mockFn.mockReset() to also reset implementations, or mockFn.mockRestore() for spies. You can also configure clearMocks: true in your Jest/Vitest config to auto-clear all mocks before each test. For module mocks, use jest.unmock() or vi.unmock() in afterEach if needed.
.mockResolvedValue(value) for successful promises and .mockRejectedValue(error) for failed ones. For example: const mockFetch = jest.fn().mockResolvedValue({ data: [] }). Then in your test, use await or .resolves/.rejects matchers. For more complex async behavior, use .mockImplementation(() => Promise.resolve(data)) or combine with mockImplementationOnce for sequential async calls.
jest.mock('module-name') or vi.mock('module-name') at the top of your test file (it gets hoisted automatically). You can provide a factory function: jest.mock('axios', () => ({ get: jest.fn().mockResolvedValue({ data: {} }) })). For Vitest, the syntax is identical: vi.mock('axios', () => ({ ... })). For Node.js built-ins like fs, you may need jest.mock('fs') or use vi.mock('fs') with Vitest.
__mocks__ directory adjacent to the module being mocked. Name mock files after the module they replace (e.g., __mocks__/axios.js). Use descriptive variable names for inline mocks: const mockGetUser = jest.fn(). Group related mocks in describe blocks and clean them up in beforeEach/afterEach hooks. Avoid sharing mock state across unrelated test suites.
jest.requireActual() or vi.importActual() to get the real module, then spread it and override specific exports: jest.mock('../utils', () => ({ ...jest.requireActual('../utils'), helperFn: jest.fn() })). In Vitest: vi.mock('../utils', async () => ({ ...(await vi.importActual('../utils')), helperFn: vi.fn() })). This technique, called "partial mocking," lets you isolate the function under test while keeping its dependencies intact.
Display an astigmatism dial and instructions for self-assessment. Educational, not a medical diagnosis.
Enter a router's MAC address or serial and generate the common default WPA passphrase for major ISP brands. Educational purpose only.
Pick colors for the shadcn/ui design system and generate the complete CSS variable theme file. Copy into your project.
Load a video and visually check if audio aligns with lips. Use frame‑by‑frame stepping. Debug playback issues.
Test how your page loads under slow, 3G, or offline conditions by intercepting fetch and applying delays. No DevTools needed.
Test the Fullscreen API: request fullscreen on a colored div, detect changes, and copy the JavaScript boilerplate.
Format a list of Q&A pairs and export as a CSV ready for Anki import. Simple line‑based template. Local.
Style underlines, overlines, and strike-throughs with colors, wavy styles, and thickness. Modern CSS text‑decoration.
Generate a random medieval occupation with a short description. For NPCs or historical curiosity. Local list.
Generate a hardboiled film noir plot with a detective, a dame, and a McGuffin. Great for creative writing prompts.
Generate a grand, aristocratic title like 'Duke of Waffleshire'. Perfect for silly fun or RPG characters. Local.
Design a button or card that glows on hover. Adjust shadow color, spread, and transition. Copy the CSS. Rich UI.
Create a realistic letterpress (debossed) text effect using CSS text‑shadow and background. Adjust depth and light direction. Copy code.
Generate a realistic‑sounding dinosaur name and see a fun description. Perfect for kids and writers.
Generate random but realistic‑looking data arrays (users, products, orders) with typos and missing fields. For test robustness.
Create a customizable checkerboard or grid background using pure CSS gradients. Adjust cell size and colors. Copy the code.
Simple interactive eye dominance test: hold up a virtual dot and see which eye stays aligned. Educational.
Create a custom HTML/CSS progress bar with percentage, colors, and animation. Copy the code. Modern UI element.
Fill in a few details and get a polished resignation letter. No data stored. Instant copy or print.
Paste plain text and turn it into a nested outline using indent levels or Markdown headings. Great for planning.
Upload a small pixel art image and get a CSS grid layout that recreates it using divs. Novelty developer tool.
Convert short text into a black‑and‑white Braille bump image ready for embossing. Educational and inclusive.
Generate a random, somewhat meaningful song lyric line. Write your own hit with AI‑free randomness. All local.
Generate a realistic‑sounding exoplanet designation (e.g., Kepler‑442b) and a sci‑fi planet description. For worldbuilding.
Generate magic squares of odd order (3x3, 5x5, …). See the sum constant and verify rows, columns, diagonals. Educational math toy.
One click to get a hilarious excuse for being late, missing homework, or not doing chores. Pure comedy.
Design a realistic-looking fake receipt with custom store name, items, and total. For jokes and gags. No real transaction.
Click to generate a random haiku from natural language templates. Pure algorithmic poetry fun. Copy and share.
Generate a QR code with a custom text label below or above. Perfect for printed signs. All generated locally as a single image.
Convert any image into beautiful ASCII art. Adjust brightness and character set for the best effect. Share text-based pictures. Runs entirely in the browser.