{"size": 819, "ext": "js", "max_stars_repo_path": "test/parse.js", "max_stars_repo_name": "nescalante/parse-link-input", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "test/parse.js", "max_issues_repo_name": "nescalante/parse-link-input", "max_issues_repo_issues_event_min_datetime": "2017-05-24T20:52:43.000Z", "max_issues_repo_issues_event_max_datetime": "2017-05-24T20:52:43.000Z", "max_forks_repo_path": "test/parse.js", "max_forks_repo_name": "nescalante/parse-link-input", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 28.2413793103, "max_line_length": 53, "alphanum_fraction": 0.6080586081}
const assert = require('assert');
const parseLinkInput = require('../index');

describe('parse-link-input', () => {
  it('parses without protocol', () => {
    const result = parseLinkInput('foo');
    assert.equal(result.href, 'http://foo');
    assert.equal(result.title, null);
  });

  it('parses with protocol', () => {
    const result = parseLinkInput('ftp://foo');
    assert.equal(result.href, 'ftp://foo');
    assert.equal(result.title, null);
  });

  it('parses with title', () => {
    const result = parseLinkInput('ftp://foo "bar"');
    assert.equal(result.href, 'ftp://foo');
    assert.equal(result.title, 'bar');
  });

  it('parses data', () => {
    const result = parseLinkInput('data:foo;bar');
    assert.equal(result.href, 'data:foo;bar');
    assert.equal(result.title, undefined);
  });
});
