text: "use strict";
  
  var _assert = _interopRequireDefault(require("assert"));
  
  var _index = _interopRequireWildcard(require("../index"));
  
  var _helper = _interopRequireDefault(require("./helper"));
  
  function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  
  var ERROR_ID = 'form.errors.presence';
  
  function test(value) {
    return (0, _helper["default"])((0, _index.presence)()(value));
  }
  
  describe('Validator: presence', function () {
    it('should be invalid when `value` is empty', function () {
      _assert["default"].strictEqual(ERROR_ID, test());
  
      _assert["default"].strictEqual(ERROR_ID, test(null));
  
      _assert["default"].strictEqual(ERROR_ID, test(''));
  
      _assert["default"].strictEqual(ERROR_ID, test('   '));
  
      _assert["default"].strictEqual(ERROR_ID, test(' \n \t '));
  
      _assert["default"].strictEqual(ERROR_ID, test(new FileList()));
  
      _assert["default"].strictEqual(ERROR_ID, test(new FileList({
        length: 0
      })));
  
      _assert["default"].strictEqual(ERROR_ID, test(new FileList([])));
  
      _assert["default"].strictEqual(ERROR_ID, (0, _helper["default"])((0, _index.required)()(' \n \t '))); // Alias
  
    });
    it('should be valid when `value` is not empty', function () {
      _assert["default"].ok(!test(1));
  
      _assert["default"].ok(!test('str'));
  
      _assert["default"].ok(!test(' abc '));
  
      _assert["default"].ok(!test(new File()));
  
      _assert["default"].ok(!test(new FileList({
        length: 1
      })));
  
      _assert["default"].ok(!test(new FileList([{}])));
  
      _assert["default"].ok(!(0, _helper["default"])((0, _index.required)()(' abc ')));
    });
    it('should use formatMessage', function () {
      var defaultValue = _index["default"].formatMessage;
  
      _index["default"].formatMessage = function (msg) {
        return Object.assign({}, msg, {
          id: msg.id + '2'
        });
      };
  
      _assert["default"].strictEqual(ERROR_ID + '2', test(''));
  
      _index["default"].formatMessage = defaultValue;
    });
  });