A reproducible fixture has a recorded origin and an expected outcome. “Generate 100 cards with seed demo” leaves out important dependencies: which generator, which network profile, which date and which negative-case settings. This project makes those dependencies explicit and includes a saved expected dataset.

A complete local project

Download the runnable fixture project and extract all files into one directory. With Node.js 22 or later:

node --test data-tools.test.mjs
node fixture-demo.mjs > fixture.json

No dependencies, payment credentials or network access are required. The first command runs assertions. The second writes a JSON array to fixture.json; its diagnostic event goes to stderr, so it does not corrupt the JSON stream.

FilePurpose
fixture-manifest.jsonVersion, seed, date and settings for a 25-row batch
fixture-expected.jsonSaved baseline to compare against the replay
fixture-demo.mjsComplete CLI entry point
data-tool-core.mjsGeneration, format checks, exports and response helpers
card-validation.mjs / card-profiles.jsonShared card arithmetic and network profiles
iban-profiles.json / identity-profiles.jsonCountry-specific shape and example data
card-preview.mjs / fixture-workflows.mjsSVG renderer and explicit local routing mock
data-tool-cases.json / data-tools.test.mjsFixed inputs, expected outcomes and assertions

The CLI is deliberately small enough to read in full:

import { readFileSync } from 'node:fs';
import { replayBulk, fixtureLog } from './data-tool-core.mjs';
const read = name => JSON.parse(readFileSync(new URL(name, import.meta.url), 'utf8'));
const rows = replayBulk(read('fixture-manifest.json'), read('card-profiles.json'));
// Keep the dataset on stdout; diagnostics contain only the allowlisted event.
process.stdout.write(JSON.stringify(rows, null, 2) + '\n');
process.stderr.write(JSON.stringify(fixtureLog(rows[0])) + '\n');

What the manifest freezes

The saved example uses seed ccg-eight-page-fixture, reference date 2026-11-08, 25 rows, an even nine-network mix and a 25% probability for each negative control. Its schemaVersion, generatorVersion and profileId identify the contract. The same seed with a different date is a different fixture: expiry generation is relative to the recorded year, not the machine’s current year.

The bulk generator can export this manifest beside its data. Keep both. The replay function requires an exact version/profile match; if it reports a mismatch, use the original bundle or intentionally migrate the fixture. Do not bypass the check and assume that identical seeds imply identical results across algorithms.

Changing a dataset should be a reviewable change: explain the new case, regenerate with the intended version/date, compare the fields that changed, then update the expected output. Regenerating a golden file solely to silence a failing test can hide a regression.

Combine named boundaries with seeded volume

Use two kinds of fixture together:

  • Named cases make one claim: an unsupported IBAN country is not accepted, "0007" stays four characters, a postcode keeps its zero, or an AVS result remains unknown. Give each an ID and an expected observation.
  • Seeded batches explore combinations and volume with reproducible output. A 25% probability does not promise exactly one bad row in four. Set a negative control to 100% when every generated row must fail that check.

The payment-form checklist maps named inputs to observations. The IBAN tool adds country/BBAN failures that a checksum-only suite misses. The prefix generator adds snapshot and longest-prefix routing cases. Keep those small cases even if a large batch also happens to cover them.

Preserve types at each boundary

Numbers used as identifiers are strings in this project. JSON retains the quotes; CSV/TSV quote fields and escape embedded quotes. Spreadsheet import can still erase leading zeros or round a 19-digit value, so set identifier columns to Text and compare the parsed value with the original string. A formatting fix after import does not recover already-lost digits.

Test data can contain a long name, accents, an ampersand or a newline in a quoted field. These are useful export tests even if your production form rejects some of them. Keep the export contract separate from the form’s acceptance policy. SQL output targets a documented seven-column fixture schema; it is not a migration for your application’s database.

Keep synthetic fixtures inside test systems

The identity tool uses placeholder streets, example-domain email and explicit phone lists or omissions. It does not prove that a name or address cannot coincide with real data. Disable outbound email, SMS and transfers in the fixture environment, and use local sinks or provider sandboxes for delivery behavior.

For diagnostics, the example program logs an allowlisted event rather than spreading the entire record. That protects this event from accidental extra fields; it does not audit every logger in your application. The security-code tool shows the exact logging test.

Checks run with publication

The site runs the shared Node test suite during its normal checks. A publication audit compares displayed code excerpts with their tested source, verifies embedded profiles and checks every ZIP member against the source file. This prevents a fixed tool from continuing to teach stale code in its article or download.

Browser testing remains separate: copy permissions, downloaded image rendering, responsive layout and assistive-technology behavior require observation in a browser. Record those results alongside the automated checks without describing one as proof of the other.

Updated 8 November 2026: a complete runnable project, explicit date manifest and golden replay replace the previous seed-only examples.

Frequently Asked Questions

Is a random seed enough to reproduce a dataset?
No. Save the generator version, profile version, settings and reference date as well. This project rejects incompatible manifests rather than silently changing output.
Should every test use a large random dataset?
No. Use small named cases for specific boundaries, and seeded batches for combinations and volume. Probabilities do not guarantee that a particular edge case will occur.
Can CSV keep card numbers and security codes unchanged?
The file preserves quoted string values, but the importing application can still infer numbers. Import identifiers as text or use JSON with an explicit schema.
Does synthetic mean impossible to match real data?
No. Generated names, addresses and account-shaped strings can coincide with real values. These tools do not verify that they are unassigned or undeliverable. Use isolated test systems with outbound delivery disabled.