Write full test coverage for the Discover card
Fri May 21 2021 14:56:57 GMT+0000 (Coordinated Universal Time)
Saved by
@ejiwen
// 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);
}
});
content_copyCOPY
Comments