var should = require('should'), // jshint ignore:line makeAbsoluteUrls = require('../../../server/utils/make-absolute-urls'), configUtils = require('../../utils/configUtils'); describe('Make absolute URLs ', function () { var siteUrl = 'http://my-ghost-blog.com', itemUrl = 'my-awesome-post'; beforeEach(function () { configUtils.set({url: 'http://my-ghost-blog.com'}); }); afterEach(function () { configUtils.restore(); }); it('does not convert absolute URLs', function () { var html = '', result = makeAbsoluteUrls(html, siteUrl, itemUrl).html(); result.should.match(//); }); it('does not convert protocol relative `//` URLs', function () { var html = '', result = makeAbsoluteUrls(html, siteUrl, itemUrl).html(); result.should.match(//); }); it('succesfully converts a relative URL', function () { var html = '', result = makeAbsoluteUrls(html, siteUrl, itemUrl).html(); result.should.match(//); }); it('succesfully converts a relative URL including subdirectories', function () { var html = '', result = makeAbsoluteUrls(html, 'http://my-ghost-blog.com/blog', itemUrl).html(); result.should.match(//); }); });