Ghost/ghost/admin/tests/unit/components/gh-url-preview-test.js
2017-03-29 10:47:46 +01:00

39 lines
1.0 KiB
JavaScript

import {describe, it} from 'mocha';
import {setupComponentTest} from 'ember-mocha';
describe('Unit: Component: gh-url-preview', function () {
setupComponentTest('gh-url-preview', {
unit: true,
needs: ['service:config']
});
it('generates the correct preview URL with a prefix', function () {
let component = this.subject({
prefix: 'tag',
slug: 'test-slug',
tagName: 'p',
classNames: 'test-class',
config: {blogUrl: 'http://my-ghost-blog.com'}
});
this.render();
expect(component.get('url')).to.equal('my-ghost-blog.com/tag/test-slug/');
});
it('generates the correct preview URL without a prefix', function () {
let component = this.subject({
slug: 'test-slug',
tagName: 'p',
classNames: 'test-class',
config: {blogUrl: 'http://my-ghost-blog.com'}
});
this.render();
expect(component.get('url')).to.equal('my-ghost-blog.com/test-slug/');
});
});