// Write full test coverage for the Discover card describe('Discover', function() { // Tests without a function will be marked as "pending" and not run // Implement these tests (and others) and make them pass! it('has a prefix of 6011 and a length of 16', function() { detectNetwork('6011345678901234').should.equal('Discover'); }); it('has a prefix of 6011 and a length of 19', function() { detectNetwork('6011345678901234012').should.equal('Discover'); }); // When it has a prefix of 65 it('has a prefix of 65 and a length of 16', function() { detectNetwork('6521345678901234').should.equal('Discover'); }); it('has a prefix of 65 and a length of 19', function() { detectNetwork('6576011345678901234').should.equal('Discover'); }); for (var prefix = 644; prefix <= 649; prefix++) { (function(currentPrefix) { it('has a prefix of ' + currentPrefix + ' and a length of 16', function() { detectNetwork(currentPrefix + '1345678901234').should.equal('Discover'); }); })(prefix); } for (var prefix = 644; prefix <= 649; prefix++) { (function(currentPrefix) { it('has a prefix of ' + currentPrefix + ' and a length of 19', function() { detectNetwork(currentPrefix + '6011345678901234').should.equal('Discover'); }); })(prefix); } });
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter