Test data only. Local fixtures do not issue cards, verify accounts or provide payment authorization. Use them only in authorized tests. Why?
5 test cards
- Generated fields are not uploaded
- Randomly generated in your browser
- Every number passes the Luhn check
Find the Discover prefix your test batch missed
A checkout can recognize 6011 and still miss the 644–649 or 65 branches used by
this generator. Generating more rows does not prove you exercised each branch. This page
adds a deterministic coverage fixture and a small report that separates missing prefixes
from duplicate numbers.
The tool produces 16-digit, Luhn-valid strings with a three-digit synthetic security code. It chooses prefixes randomly and has no individual-prefix selector. The fixed download below is an additional test set; it is not the next batch the button will generate.
Define the coverage target before counting rows
For this exercise, split the generator configuration into eight branches:
6011, 644, 645, 646, 647, 648, 649 and 65. The report checks only those
prefixes and a 16-digit string shape. It does not run Luhn or identify an issuer.
Braintree’s card-type configuration also lists these Discover prefix patterns and includes a 19-digit length. Our generator uses only 16 digits. A 19-digit input is therefore outside this exercise’s target, not evidence that the wider network rejects it. Prefix matches should not decide co-brand routing.
| Fixture input | Expected report effect | Defect exposed |
|---|---|---|
| One number for each of the eight branches | No missing branches; eight unique numbers | A detector tested only with 6011 |
A second copy of 6011123456789019 | 6011 count becomes two; unique count stays eight | Treating row count as distinct coverage |
A 16-digit string starting with 62 | Listed under rejected row IDs | Counting a different profile as Discover coverage |
A 19-digit string starting with 6011 | Also listed under rejected row IDs | Mixing different length targets without labeling them |
| Twenty-five repeats of the first fixture | Seven branches still missing | Assuming the batch limit guarantees coverage |
The two rejected rows are deliberately Luhn-valid. That makes them useful controls: a checksum pass must not make an out-of-profile row satisfy this particular coverage target. For a checksum-focused exercise, use the card validator.
Download and run the coverage report
Save the fixed Discover batch and the executable coverage checks in the same directory:
node --test discover-coverage.test.mjs
The fixture has eleven rows: eight distinct in-profile numbers, one duplicate, and two
out-of-profile controls. Its expected report is eight unique values, one duplicate, two
rejected IDs and an empty missing list. The runner asserts that report and also tests an
empty batch, a repeated-only batch and misleading export metadata.
const families = ['6011', '644', '645', '646', '647', '648', '649', '65'];
function summarizeCoverage(records) {
const counts = Object.fromEntries(families.map(prefix => [prefix, 0]));
const seen = new Set();
let duplicates = 0;
const rejected = [];
for (const row of records) {
const n = row.number;
const family = typeof n === 'string' && /^\d{16}$/.test(n)
? families.find(prefix => n.startsWith(prefix)) : undefined;
if (!family) {
rejected.push(row.id);
continue;
}
counts[family] += 1;
if (seen.has(n)) duplicates += 1;
seen.add(n);
}
return {
counts,
missing: families.filter(prefix => counts[prefix] === 0),
unique: seen.size,
duplicates,
rejected
};
}To use the report with a generator export, parse the JSON and normalize its container:
one generated card is an object; multiple cards are an array. Assign row IDs for useful
error messages and pass the unformatted number strings to summarizeCoverage.
The network label is intentionally ignored so a label cannot conceal the wrong digits.
Connect coverage to an actual assertion
Coverage alone does not show that your checkout identified any of these numbers correctly. Loop over the eight in-profile fixture rows, send each to your application’s detector, and assert the expected brand under your configured detection rules. Then verify the same label in the form. Keep the two controls in a separate profile-validation assertion.
If all prefixes appear in the report but a logo is wrong, inspect the full detection chain. A broad Maestro fallback can claim a more specific match; the Maestro candidate-resolution exercise demonstrates that failure. For exact range endpoints, use the Mastercard boundary fixtures. Those are different tests from sampling one representative of each branch here.
Add random generated batches after the deterministic set, keeping the fixture file in version control. When a random case fails, save that synthetic input with its expected result so the regression is reproducible. Use the provider test-card reference for gateway responses; these coverage rows do not define sandbox approvals or declines.