Private State Token Demo - Online Anti‑Fraud Test
Issue and redeem Private State Tokens (formerly Trust Tokens). Understand how they help detect bots without cookies.
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.
Issue and redeem Private State Tokens (formerly Trust Tokens). Understand how they help detect bots without cookies.
Check if your site is cross‑origin isolated by examining the COOP and COEP headers. See if SharedArrayBuffer is available.
Create Latin squares for experimental design or tournament scheduling. Visual and copyable. No server required.
Generate UUID v7 identifiers that are lexicographically sortable and timestamped. Perfect for databases. All local.
Write CSS with native nesting (like SCSS) and see the browser’s native parsing. Validator and live output.
Generate short, URL‑safe, unique string IDs with customizable alphabet and length. Smaller than UUID. Local only.
Spin the globe and get a random country or city to visit. Learn a fun fact. Plan your next adventure. Local data.
Experiment with CSS Grid properties visually. Add rows, columns, and areas. See the grid in action and copy the code.
Drag items into grid cells and see the resulting grid‑area or line‑based placement code. Learn how auto‑placement and spanning work.
Encode text into Wingdings symbols and decode Wingdings back to text. A nostalgic and fun puzzle tool. All processing in your browser.
Encode letters to their position in the alphabet (A=1, B=2...) and decode back. A classic puzzle tool. No data leaves your device.
Intercept and manage navigations without reloading. Test transition handling and URL updates. The future of client‑side routing.
Convert climbing difficulty between V‑scale, Fontainebleau, and Yosemite Decimal System. Quick reference for gym climbers.
Generate a valid BookCrossing BCID with checksum for your free book tracking label. Follows BCID format rules. Fun for sharing books.
Upload a photo, enter details, and create a tear-off style lost pet poster. Instant PDF download.
Load a video and visually check if audio aligns with lips. Use frame‑by‑frame stepping. Debug playback issues.
Visually configure scroll‑snap containers and items. Adjust alignment, stop behavior, and padding. Copy the clean CSS instantly.
Generate the MD5 hash of any text string. For quick integrity checks. All local computation.
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.
Check if your browser and display support the wider DCI‑P3 color space. See the difference with a simple test pattern.
Generate a random medieval occupation with a short description. For NPCs or historical curiosity. Local list.
Design a fully styled scrollbar with colors, width, radius, and hover effects. Supports both ::-webkit‑scrollbar and Firefox scrollbar‑width.
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.
Pick a method, URL, headers, and body, then send an HTTP request directly from your browser. Debug APIs easily.
Simple interactive eye dominance test: hold up a virtual dot and see which eye stays aligned. Educational.
Paste a test card number to verify Luhn algorithm, identify issuer (Visa, MC), and check length. No real data.
Upload a small pixel art image and get a CSS grid layout that recreates it using divs. Novelty developer tool.
Generate a random, funny or serious company slogan for your startup idea. Brainstorming helper. All local.