{"size": 1570, "ext": "js", "max_stars_repo_path": "server/src/helpers/urlHasDomain.test.js", "max_stars_repo_name": "jbis9051/Socratic-Answers", "max_stars_repo_stars_event_min_datetime": "2020-02-22T02:18:29.000Z", "max_stars_repo_stars_event_max_datetime": "2020-07-22T17:27:02.000Z", "max_issues_repo_path": "server/src/helpers/urlHasDomain.test.js", "max_issues_repo_name": "jbis9051/nodeqa", "max_issues_repo_issues_event_min_datetime": "2020-02-24T21:00:26.000Z", "max_issues_repo_issues_event_max_datetime": "2020-03-01T17:04:54.000Z", "max_forks_repo_path": "server/src/helpers/urlHasDomain.test.js", "max_forks_repo_name": "jbis9051/Socratic-Answers", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 7, "max_issues_count": 5, "max_forks_count": null, "avg_line_length": 36.511627907, "max_line_length": 98, "alphanum_fraction": 0.6401273885}
const mocha = require('mocha');
const assert = require('assert');
const urlHasDomain = require('./urlHasDomain');


describe('url domains', function () {
    it('url simple', function () {
        assert.strictEqual(urlHasDomain("https://google.com", "google.com"), true);
    });

    it('url simple fail', function () {
        assert.strictEqual(urlHasDomain("https://facebook.com", "google.com"), false);
    });

    it('url tld fail', function () {
        assert.strictEqual(urlHasDomain("https://google.com", "google.org"), false);
    });

    it('url subdomain with no subdomain domain', function () {
        assert.strictEqual(urlHasDomain("https://cloud.google.com", "google.com"), true);
    });

    it('url subdomain with no subdomain domain fail', function () {
        assert.strictEqual(urlHasDomain("https://cloud.facebook.com", "google.com"), false);
    });

    it('url subdomain with subdomain domain', function () {
        assert.strictEqual(urlHasDomain("https://cloud.google.com", "cloud.google.com"), true);
    });

    it('url subdomain with no subdomain domain fail', function () {
        assert.strictEqual(urlHasDomain("https://cloud.facebook.com", "cloud.google.com"), false);
    });

    it('url subdomain with no subdomain domain fail 2', function () {
        assert.strictEqual(urlHasDomain("https://console.google.com", "cloud.google.com"), false);
    });

    it('url subdomain with subdomain domain fail 3', function () {
        assert.strictEqual(urlHasDomain("https://google.com", "cloud.google.com"), false);
    });
});
