Files
browser-wakatime/tests/helpers/getDomainFromUrl.spec.js
Vu Nguyen 9ef655ac3b Setup CI tests (#100)
* use @xarc/xrun to streamline tasks in an imperative manner

* add lint-staged/husky for git hook tasks

* run prettier across all files

* fixing tests

* add ci test workflow

* add a ci workflow

* remove precommit in favor of husky

* add .prettierrc.js

* reformat with prettier
2021-01-13 21:05:05 -08:00

24 lines
753 B
JavaScript

var chai = require('chai');
var expect = chai.expect;
var getDomainFromUrl = require('../../assets/js/helpers/getDomainFromUrl');
describe('getDomainFromUrl', function () {
it('should be a function', function () {
expect(getDomainFromUrl).to.be.a('function');
});
it('should return the domain', function () {
expect(getDomainFromUrl('http://google.com/something/very/secret')).to.equal(
'http://google.com',
);
expect(getDomainFromUrl('http://www.google.com/something/very/secret')).to.equal(
'http://www.google.com',
);
// This is not how it was imaged to work, but let's leave it here as a warning.
expect(getDomainFromUrl('google.com/something/very/secret')).to.equal('google.com//very');
});
});