Choose a card type
How many?
1

Test data only. Local fixtures do not issue cards, verify accounts or provide payment authorization. Use them only in authorized tests. Why?

VisaTEST CARD
•••• •••• •••• ••••
Cardholder—
ExpiresMM/YY
CVV•••
  • 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 inputExpected report effectDefect exposed
One number for each of the eight branchesNo missing branches; eight unique numbersA detector tested only with 6011
A second copy of 60111234567890196011 count becomes two; unique count stays eightTreating row count as distinct coverage
A 16-digit string starting with 62Listed under rejected row IDsCounting a different profile as Discover coverage
A 19-digit string starting with 6011Also listed under rejected row IDsMixing different length targets without labeling them
Twenty-five repeats of the first fixtureSeven branches still missingAssuming 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.

Frequently Asked Questions

Does generating 25 Discover numbers cover every prefix?
No. Prefixes are selected randomly, so a batch can repeat a prefix or omit one. Use the fixed fixture to cover all eight branches of this generator profile, then add random batches for variation.
Why does the report count eight branches?
It counts 6011, each of 644 through 649, and 65 separately. This measures the configured generator branches, not the number of Discover issuer ranges.
Is a rejected row necessarily an invalid card number?
No. Rejected means outside this report’s 16-digit prefix profile, or not supplied as a digit string. It is not an account, checksum or authorization decision.
Can I import the generator’s JSON into the example?
Yes. Parse the export, wrap a single record in an array, and assign a stable id to each row before passing it to summarizeCoverage. Use the number field; formattedNumber contains display separators.