mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-22 18:31:57 +03:00
95d27e7f58
- this is a small part of a bit of cleanup of our test files - the goal is to make the existing tests clearer with a view to making it easier to write more tests - this makes the test structure follow the codebase structure more closely - eventually we will colocate the frontend tests with the frontend code
36 lines
1.3 KiB
JavaScript
36 lines
1.3 KiB
JavaScript
const should = require('should');
|
|
|
|
// Stuff we are testing
|
|
const facebook_url = require('../../../../core/frontend/helpers/facebook_url');
|
|
|
|
describe('{{facebook_url}} helper', function () {
|
|
const 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'};
|
|
|
|
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'};
|
|
|
|
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'};
|
|
|
|
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(facebook_url(options), null);
|
|
});
|
|
});
|