Reproducible card fixtures
Generate up to 10,000 local test records. Save the manifest to replay the batch with the same version and date.
Seed, date and negative cases
Synthetic format data for isolated tests. No account or payment acceptance checks. Percentages are sampling probabilities, not exact row quotas.
Batch manifest
A large test dataset is useful only when a failed run can be reproduced. This tool captures the seed, reference date, generator version, profile version and sampling settings in a separate manifest. Save it beside the exported data rather than keeping only a seed in a ticket.
Replay the same batch after New Year
A generator that reads the current year internally changes its expiry fields when January arrives. Here the reference date is explicit. Future rows get a year one to five years after its year; expired rows get a year one to three years before it. The random month remains a two-digit string. This is intentionally coarse expiry sampling; use fixed same-month cases for boundary tests.
Open Seed, date and negative cases and try seed ccg-eight-page-fixture, reference date 2026-11-08, quantity 25, even network mix and 25% for both negative controls. This configuration is also saved in the example project. A generated row may be both expired and Luhn-invalid because the two choices are independent.
The replay function rejects an incompatible bundle instead of silently creating different output:
export function replayBulk(manifest, profile) {
if (manifest.schemaVersion !== 1 || manifest.generatorVersion !== DATA_VERSION || manifest.profileId !== profile.id) {
throw new Error('Manifest version or profile differs; use the original bundle');
}
const session = bulkSession({ ...manifest.settings, seed: manifest.seed, referenceDate: manifest.referenceDate }, profile);
return Array.from({ length: manifest.settings.count }, () => session.next());
}Download the replay project with its golden dataset
. Run node --test data-tools.test.mjs, then node fixture-demo.mjs > fixture.json. The tests compare the complete replay to fixture-expected.json, including names, security codes and expiry strings. The test-data management guide covers updating that baseline deliberately.
Network labels that agree with the validator
Generation uses the same profile as the main card generator. In particular, Maestro generation avoids the broad 56–69 detection fallback, and UnionPay is included as a ninth network. The table below is rendered from the exact configuration passed to both tools.
| Network | Configured prefixes | Lengths |
|---|---|---|
| American Express | 34, 37 | 15 |
| Diners Club | 300–305, 36, 38, 39 | 14 |
| Discover | 6011, 65, 644–649 | 16 |
| JCB | 3528–3589 | 16 |
| Maestro | 50, 56–58, 6304, 6759, 6761–6763 | 16, 19 |
| Mastercard | 51–55, 2221–2720 | 16 |
| Troy | 9792 | 16 |
| UnionPay | 62, 81 | 16, 19 |
| Visa | 4 | 16 |
These are local generation profiles, not exhaustive issuer allocations. A test for overlapping prefixes belongs in a separately named ambiguity fixture. It should not appear as an ordinary Maestro record whose number is classified as Discover. The shared tests generate 250 records per network and independently inspect brand, supported length, checksum, security-code length and uniqueness within each batch.
Choose a data format deliberately
| Format | Shape | Import detail |
|---|---|---|
| JSON | Array of eight-field objects | Card number, month, year and code remain strings |
| JSONL | One object per line | Useful for streaming test runners |
| CSV / TSV | Eight quoted columns with a header | Import identifier columns as text; quoting does not stop spreadsheet conversion |
| SQL | Seven-column test_payment_methods INSERT | Omits the name; verify your local schema before executing |
| Manifest | Separate JSON object | Describes the batch, not a replacement for the data file |
The JSON keys are cardNumber, network, expMonth, expYear, cvv, cardholderName, luhnValid and expired. CSV/TSV use snake_case headers for the multiword names. Embedded quotes are doubled in delimited exports. SQL escapes string quotes and keeps numeric-looking identifiers quoted.
The browser previews at most 25 rows. Copy all rows and Download data use the full batch. Changing settings leaves the old batch and manifest intact until Generate is pressed; changing the export format only reformats those existing rows. During generation the batch settings are locked, and export is disabled until all rows are ready.
Negative cases and their limits
At 100% invalid Luhn, every final check digit is changed by a nonzero offset. At 100% expired, every row precedes the reference year. At intermediate percentages the exact count varies: they are probabilities, not quotas. Empty input, pasted letters, current-month expiry and incomplete prefixes need small explicit cases from the payment-form checklist, rather than hoping a random batch produces them.
No generated row establishes an account, balance or gateway outcome. Use the processor test-card reference for sandbox authorization flows. Keep generated fixtures in isolated test environments.
Updated 8 November 2026: nine shared profiles, fixed reference dates and downloadable replay manifests replace the previous year-dependent implementation.