Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- describe('tests', function () {
- let card;
- beforeEach(function () {
- card = new SubscriptionCard('Pesho', 'Petrov', '00000000');
- });
- it('1', function () {
- expect(card.firstName).to.equals('Pesho');
- expect(card.lastName).to.equals('Petrov');
- expect(card.SSN).to.equals('00000000');
- expect(card.isBlocked).to.equals(false);
- expect(card._subscriptions).to.be.an('array');
- });
- it('2', function () {
- card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
- card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
- expect(card._subscriptions).to.have.lengthOf(2)
- });
- it('3', function () {
- card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
- card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
- card.block();
- expect(card.isBlocked).to.equals(true)
- });
- it('4', function () {
- card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
- card.addSubscription('*', new Date('2018-05-25'), new Date('2018-06-24'));
- card.block();
- card.unblock();
- expect(card.isBlocked).to.equals(false)
- });
- it('5', function () {
- card.addSubscription('120', new Date('2018-04-22'), new Date('2018-05-21'));
- expect(card.isValid('120', new Date('2018-04-22'))).to.equals(true);
- expect(card.isValid('120', new Date('2018-04-21'))).to.equals(false);
- expect(card.isValid('120', new Date('2018-05-21'))).to.equals(true);
- expect(card.isValid('120', new Date('2018-05-22'))).to.equals(false);
- expect(card.isValid('*', new Date('2018-05-11'))).to.equals(false);
- });
- it('6', function () {
- card.addSubscription('*', new Date('2018-04-22'), new Date('2018-05-21'));
- expect(card.isValid('1', new Date('2018-04-22'))).to.equals(true);
- expect(card.isValid('*', new Date('2018-04-21'))).to.equals(false);
- expect(card.isValid('2', new Date('2018-05-21'))).to.equals(true);
- expect(card.isValid('*', new Date('2018-05-22'))).to.equals(false);
- expect(card.isValid('*', new Date('2018-05-13'))).to.equals(true);
- expect(card.isValid('3', new Date('2018-05-22'))).to.equals(false);
- expect(card.isValid('4', new Date('2018-04-21'))).to.equals(false);
- })
- it('7', function () {
- card.firstName = 'Asen';
- card.lastName = 'Asenov';
- card.SSN = '123123';
- expect(card.firstName).to.equals('Pesho');
- expect(card.lastName).to.equals('Petrov');
- expect(card.SSN).to.equals('00000000');
- })
- it('8', function () {
- card = new SubscriptionCard('Antonia')
- expect(card.firstName).to.equals('Antonia')
- expect(card.lastName).to.be.undefined
- expect(card.SSN).to.be.undefined
- card = new SubscriptionCard('Antonia', 'Goshova')
- expect(card.firstName).to.equals('Antonia')
- expect(card.lastName).to.equals('Goshova')
- expect(card.SSN).to.be.undefined
- card = new SubscriptionCard('Antonia', 'Goshova', '1111')
- expect(card.firstName).to.equals('Antonia')
- expect(card.lastName).to.equals('Goshova')
- expect(card.SSN).to.equals('1111')
- expect(card.isValid('120', new Date('2018-04-22'))).to.equals(false)
- expect(card.isValid('120')).to.equals(false)
- })
- it('9', function () {
- card = new SubscriptionCard('Antonia', 'Goshova', '1111')
- card.addSubscription('*', new Date('2018-04-01'), new Date('2018-05-01'));
- card.block();
- expect(card.isValid('120', new Date('2018-04-22'))).to.equals(false)
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement