import * as validation from '../src/js/index';


describe('validation form', function() {
  describe('email', function() {
        it('empty', function() {
          expect(validation.validateEmail('')).toBe(false);
        });
        it('not empty not valid', function() {
          expect(validation.validateEmail('liliia.com.ua')).toBe(false);
        });
        it('valid email', function() {
          expect(validation.validateEmail('liliia@com.ua')).toBe(true);
        });
    });
  describe('fullName', function() {
    it('empty', function() {
      expect(validation.validateName('')).toBe(false);
    });
    it('not empty not letters', function() {
      expect(validation.validateName('12345')).toBe(false);
    });
    it('not empty not only letters', function() {
      expect(validation.validateName('liliia12345')).toBe(false);
    });
    it('not empty not full', function() {
      expect(validation.validateName('liliia')).toBe(false);
    });
    it('valid name', function() {
      expect(validation.validateName('liliia sydorenko')).toBe(true);
    });
  });
  describe('phone number', function() {
    it('empty', function() {
      expect(validation.validatePhone('')).toBe(false);
    });
    it('not empty not number', function() {
      expect(validation.validatePhone('my_number')).toBe(false);
    });
    it('not empty not only numbers', function() {
      expect(validation.validatePhone('my_number1234')).toBe(false);
    });
    it('not empty not valid', function() {
      expect(validation.validatePhone('9058473847')).toBe(false);
    });
    it('valid phone number', function() {
      expect(validation.validatePhone('0935647477')).toBe(true);
    });
    it('valid phone number', function() {
      expect(validation.validatePhone('+380935647477')).toBe(true);
    });
  });
  describe('massage', function() {
     it('empty', function() {
       expect(validation.validateMessage('')).toBe(false);
     });
     it('valid message', function() {
       expect(validation.validateMessage('Some message for you')).toBe(true);
     });
   });
  describe('trimming spaces', function() {
    it('should trim all spaces before validation', function() {
      expect(validation.inputTrimming('   my name ')).toBe('my name');
    });
  });
  describe('add success message', function() {

    it('should change default message to success', function() {
      var header = document.createElement('h3');
      expect(validation.submitButton(header)).toBe("Thank you for your feedback");
    });
  });
  describe('card validation', function() {

    it('should add space between each 4 numbers', function() {
      expect(validation.splitCard('4731185606294277')).toBe("4731 1856 0629 4277");
    });
    it('should validate card (16 characters, right numbers)', function() {
      expect(validation.validateCard('4731185606294277')).toBe(true);
    });
    it('should validate card (16 characters, right numbers)', function() {
      expect(validation.validateCard('47456jjkkkj')).toBe(false);
    });
  });
});


@@ -2284,27 +2284,23 @@
 be('
-add success message
+card validation
 ', f
@@ -2303,33 +2303,32 @@
 ', function() %7B%0A
-%0A
     it('should c
@@ -2330,186 +2330,284 @@
 uld 
-change default message to success', function() %7B%0A      var header = document.createElement('h3');%0A      expect(validation.submitButton(header)).toBe(%22Thank you for your feedback%22
+validate card (16 characters, right numbers)', function() %7B%0A      expect(validation.validateCard('4731185606294277')).toBe(true);%0A    %7D);%0A    it('should validate card (16 characters, right numbers)', function() %7B%0A      expect(validation.validateCard('47456jjkkkj')).toBe(false
 );%0A 
@@ -2623,36 +2623,36 @@
 %7D);%0A  describe('
-card
+date
  validation', fu
@@ -2662,17 +2662,16 @@
 ion() %7B%0A
-%0A
     it('
@@ -2681,207 +2681,307 @@
 uld 
-add space between each 4 numbers', function() %7B%0A      expect(validation.splitCard('4731185606294277')).toBe(%224731 1856 0629 4277%22);%0A    %7D);%0A    it('should validate card (16 characters, right numbers)
+validate date with wrong info', function() %7B%0A      expect(validation.validateDate('my-date')).toBe(false);%0A    %7D);%0A    it('should validate date with wrong format', function() %7B%0A      expect(validation.validateDate('10 jun 2010')).toBe(false);%0A    %7D);%0A    it('should validate date with correct format
 ', f
@@ -3024,38 +3024,32 @@
 validate
-Card('4731185606294277
+Date('11-12-2012
 ')).toBe
@@ -3092,43 +3092,32 @@
 ate 
-card (16 characters, right numbers)
+date with correct format
 ', f
@@ -3160,33 +3160,32 @@
 validate
-Card('47456jjkkkj
+Date('11/12/2012
 ')).toBe
@@ -3177,36 +3177,35 @@
 12/2012')).toBe(
-fals
+tru
 e);%0A    %7D);%0A  %7D)

Add test for validation date