import * as validate from '../validate';
var emptyVals = [[], {}, null, undefined, function () {}, ''];
describe('validate utils', function () {
  describe('isEmptyText', function () {
    it('should return `Required` for non string or empty values', function () {
      emptyVals.forEach(function (value) {
        expect(validate.isEmptyText(value)).toEqual('Required');
      });
    });
    it('should return `undefined` for non empty strings', function () {
      var values = ['!@$&%&^%61527[]+_P{p]9', 'test string'];
      values.forEach(function (value) {
        expect(validate.isEmptyText(value)).toEqual(undefined);
      });
    });
  });
  describe('isEmptyRadio', function () {});
  describe('isEmptyCheck', function () {
    it('should return `Required` for empty arrays', function () {
      expect(validate.isEmptyCheck(undefined)).toBe('Required');
      expect(validate.isEmptyCheck([])).toBe('Required');
    });
  });
  describe('isValidEmail', function () {
    it('should return an error for invalid emails', function () {
      expect(validate.isValidEmail('abc.com')).toBeDefined();
    });
    it('should return a falsey value for valid emails', function () {
      expect(validate.isValidEmail('test@domain.com')).toBeFalsy();
    });
  });
});