Discover And Maestro Card

PHOTO EMBED

Thu May 20 2021 15:44:15 GMT+0000 (Coordinated Universal Time)

Saved by @ejiwen

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');
  });
});

describe('Maestro', function() {
  // Write full test coverage for the Maestro card
  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('Maestro');
            });
            it('has a prefix of ' + currentPrefix + ' and a length of 19', function(){
              detectNetwork(currentPrefix+'6011345678901234').should.equal('Maestro');
            });
          })(prefix)
  }

  // When it has a prefix of 65
  it('has a prefix of 65 and a length of 16', function(){
    detectNetwork('6521345678901234').should.equal('Maestro');
  });
  it('has a prefix of 65 and a length of 19', function(){
    detectNetwork('6576011345678901234').should.equal('Maestro');
  });
});
content_copyCOPY