// Write full test coverage for the Switch describe('Switch', function() { // Switch with prefix of 564182 or 633110 var switchPrefix = [564182, 633110]; for (var prefixIndex = 0; prefixIndex < switchPrefix.length; prefixIndex++) { (function(currentIndex) { it('has a prefix of ' + switchPrefix[currentIndex] + ' and a length of 16', function() { detectNetwork(switchPrefix[currentIndex] + '1234567890').should.equal('Switch'); }); it('has a prefix of ' + switchPrefix[currentIndex] + ' and a length of 18', function() { detectNetwork(switchPrefix[currentIndex] + '123456789012').should.equal('Switch'); }); it('has a prefix of ' + switchPrefix[currentIndex] + ' and a length of 19', function() { detectNetwork(switchPrefix[currentIndex] + '1234567890123').should.equal('Switch'); }); })(prefixIndex); } // Switch with prefix of 4903, 4905, 4911, 4936, 6333 or 6759 var switchPrefix2 = [4903, 4905, 4911, 4936, 6333, 6759]; for (var prefixIndex = 0; prefixIndex < switchPrefix2.length; prefixIndex++) { (function(currentIndex) { it('has a prefix of ' + switchPrefix2[currentIndex] + ' and a length of 16', function() { detectNetwork(switchPrefix2[currentIndex] + '123456789012').should.equal('Switch'); }); it('has a prefix of ' + switchPrefix2[currentIndex] + ' and a length of 18', function() { detectNetwork(switchPrefix2[currentIndex] + '12345678901234').should.equal('Switch'); }); it('has a prefix of ' + switchPrefix2[currentIndex] + ' and a length of 19', function() { detectNetwork(switchPrefix2[currentIndex] + '123456789012345').should.equal('Switch'); }); })(prefixIndex); } });
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