2020-04-29 18:44:27 +03:00
|
|
|
const should = require('should');
|
2016-05-17 16:06:12 +03:00
|
|
|
|
2020-04-29 18:44:27 +03:00
|
|
|
// Stuff we are testing
|
|
|
|
const helpers = require('../../../core/frontend/helpers');
|
2016-05-17 16:06:12 +03:00
|
|
|
|
|
|
|
describe('{{facebook_url}} helper', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
const options = {data: {site: {}}};
|
2016-05-17 16:06:12 +03:00
|
|
|
|
|
|
|
beforeEach(function () {
|
2019-09-10 12:37:04 +03:00
|
|
|
options.data.site = {facebook: ''};
|
2016-05-17 16:06:12 +03:00
|
|
|
});
|
|
|
|
|
2019-09-10 12:37:04 +03:00
|
|
|
it('should output the facebook url for @site, if no other facebook username is provided', function () {
|
|
|
|
options.data.site = {facebook: 'hey'};
|
2016-05-17 16:06:12 +03:00
|
|
|
|
|
|
|
helpers.facebook_url.call({}, options).should.equal('https://www.facebook.com/hey');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should output the facebook url for the local object, if it has one', function () {
|
2019-09-10 12:37:04 +03:00
|
|
|
options.data.site = {facebook: 'hey'};
|
2016-05-17 16:06:12 +03:00
|
|
|
|
|
|
|
helpers.facebook_url.call({facebook: 'you/there'}, options).should.equal('https://www.facebook.com/you/there');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should output the facebook url for the provided username when it is explicitly passed in', function () {
|
2019-09-10 12:37:04 +03:00
|
|
|
options.data.site = {facebook: 'hey'};
|
2016-05-17 16:06:12 +03:00
|
|
|
|
|
|
|
helpers.facebook_url.call({facebook: 'you/there'}, 'i/see/you/over/there', options)
|
|
|
|
.should.equal('https://www.facebook.com/i/see/you/over/there');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should return null if there are no facebook usernames', function () {
|
|
|
|
should.equal(helpers.facebook_url(options), null);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|