Ghost/test/unit/helpers/facebook_url_spec.js
Hannah Wolfe 7f1d3ebc07
Move tests from core to root (#11700)
- move all test files from core/test to test/
- updated all imports and other references
- all code inside of core/ is then application code
- tests are correctly at the root level
- consistent with other repos/projects

Co-authored-by: Kevin Ansfield <kevin@lookingsideways.co.uk>
2020-03-30 16:26:47 +01:00

37 lines
1.3 KiB
JavaScript

var should = require('should'),
// Stuff we are testing
helpers = require('../../../core/frontend/helpers');
describe('{{facebook_url}} helper', function () {
var options = {data: {site: {}}};
beforeEach(function () {
options.data.site = {facebook: ''};
});
it('should output the facebook url for @site, if no other facebook username is provided', function () {
options.data.site = {facebook: 'hey'};
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 () {
options.data.site = {facebook: 'hey'};
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 () {
options.data.site = {facebook: 'hey'};
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);
});
});