{"size": 838, "ext": "js", "max_stars_repo_path": "core/tools/transforms/angular-api-package/content-rules/minLength.spec.js", "max_stars_repo_name": "ngDocs/ngdocs", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "core/tools/transforms/angular-api-package/content-rules/minLength.spec.js", "max_issues_repo_name": "ngDocs/ngdocs", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "core/tools/transforms/angular-api-package/content-rules/minLength.spec.js", "max_forks_repo_name": "ngDocs/ngdocs", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 44.1052631579, "max_line_length": 97, "alphanum_fraction": 0.6766109785}
const createMinLengthRule = require('./minLength');

describe('createMinLength rule', () => {
  const defaultRule = createMinLengthRule();
  const atLeast5CharsRule = createMinLengthRule(5);

  it('should return `undefined` if the length of the property value is long enough', () => {
    expect(defaultRule({}, 'description', 'abc')).toBeUndefined();
    expect(atLeast5CharsRule({}, 'description', 'abcde')).toBeUndefined();
  });

  it('should return an error message if length of the property value is not long enough', () => {
    expect(defaultRule({}, 'description', 'a'))
        .toEqual('Invalid "description" property: "a". It must have at least 2 characters.');
    expect(atLeast5CharsRule({}, 'description', 'abcd'))
        .toEqual('Invalid "description" property: "abcd". It must have at least 5 characters.');
  });
});
