Advertisement
Guest User

Untitled

a guest
Jul 11th, 2018
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. describe('tests', function () {
  2.     let card;
  3.     beforeEach(function () {
  4.         card = new SubscriptionCard('Pesho', 'Petrov', '00000000');
  5.     });
  6.     it('1', function () {
  7.         expect(card.firstName).to.equals('Pesho');
  8.         expect(card.lastName).to.equals('Petrov');
  9.         expect(card.SSN).to.equals('00000000');
  10.         expect(card.isBlocked).to.equals(false);
  11.         expect(card._subscriptions).to.be.an('array');
  12.     });
  13.  
  14.     it('2', function () {
  15.         card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
  16.         card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
  17.         expect(card._subscriptions).to.have.lengthOf(2)
  18.     });
  19.  
  20.     it('3', function () {
  21.         card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
  22.         card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
  23.         card.block();
  24.         expect(card.isBlocked).to.equals(true)
  25.     });
  26.     it('4', function () {
  27.         card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
  28.         card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
  29.         card.block();
  30.         card.unblock();
  31.         expect(card.isBlocked).to.equals(false)
  32.     });
  33.  
  34.     it('5', function () {
  35.         card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
  36.  
  37.         expect(card.isValid('120', new Date('2018-04-22'))).to.equals(true);
  38.         expect(card.isValid('120', new Date('2018-04-21'))).to.equals(false);
  39.         expect(card.isValid('120', new Date('2018-05-21'))).to.equals(true);
  40.         expect(card.isValid('120', new Date('2018-05-22'))).to.equals(false);
  41.         expect(card.isValid('*', new Date('2018-05-11'))).to.equals(false);
  42.     });
  43.  
  44.     it('6', function () {
  45.         card.addSubscription('*', new Date('2018-04-22'), new Date('2018-05-21'));
  46.  
  47.         expect(card.isValid('1', new Date('2018-04-22'))).to.equals(true);
  48.         expect(card.isValid('*', new Date('2018-04-21'))).to.equals(false);
  49.         expect(card.isValid('2', new Date('2018-05-21'))).to.equals(true);
  50.         expect(card.isValid('*', new Date('2018-05-22'))).to.equals(false);
  51.         expect(card.isValid('*', new Date('2018-05-13'))).to.equals(true);
  52.         expect(card.isValid('3', new Date('2018-05-22'))).to.equals(false);
  53.         expect(card.isValid('4', new Date('2018-04-21'))).to.equals(false);
  54.     })
  55.  
  56.     it('7', function () {
  57.         card.firstName = 'Asen';
  58.         card.lastName = 'Asenov';
  59.         card.SSN = '123123';
  60.  
  61.         expect(card.firstName).to.equals('Pesho');
  62.         expect(card.lastName).to.equals('Petrov');
  63.         expect(card.SSN).to.equals('00000000');
  64.     })
  65.  
  66.     it('8', function () {
  67.         card = new SubscriptionCard('Antonia')
  68.         expect(card.firstName).to.equals('Antonia')
  69.         expect(card.lastName).to.be.undefined
  70.         expect(card.SSN).to.be.undefined
  71.  
  72.         card = new SubscriptionCard('Antonia', 'Goshova')
  73.         expect(card.firstName).to.equals('Antonia')
  74.         expect(card.lastName).to.equals('Goshova')
  75.         expect(card.SSN).to.be.undefined
  76.  
  77.         card = new SubscriptionCard('Antonia', 'Goshova', '1111')
  78.         expect(card.firstName).to.equals('Antonia')
  79.         expect(card.lastName).to.equals('Goshova')
  80.         expect(card.SSN).to.equals('1111')
  81.         expect(card.isValid('120', new Date('2018-04-22'))).to.equals(false)
  82.         expect(card.isValid('120')).to.equals(false)
  83.  
  84.     })
  85.  
  86.     it('9', function () {
  87.         card = new SubscriptionCard('Antonia', 'Goshova', '1111')
  88.         card.addSubscription('*', new Date('2018-04-01'), new Date('2018-05-01'));
  89.         card.block();
  90.         expect(card.isValid('120', new Date('2018-04-22'))).to.equals(false)
  91.  
  92.     })
  93.  
  94. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement