Ghost/ghost/admin/tests/integration/helpers/gh-url-preview-test.js
Kevin Ansfield 1520122483 Refactored deprecated usage of setupTest* methods
no issue

- https://github.com/emberjs/ember-mocha/blob/master/docs/migration.md#upgrading-to-the-new-testing-apis
- deleted tests files which had no specific tests
- migrated unskipped component unit tests to integration tests
2019-05-13 15:31:32 +01:00

39 lines
1.2 KiB
JavaScript

import Service from '@ember/service';
import hbs from 'htmlbars-inline-precompile';
import {describe, it} from 'mocha';
import {expect} from 'chai';
import {render} from '@ember/test-helpers';
import {setupRenderingTest} from 'ember-mocha';
describe('Unit: Component: gh-url-preview', function () {
setupRenderingTest();
beforeEach(function () {
let configStub = Service.extend({
blogUrl: 'http://my-ghost-blog.com'
});
this.owner.register('service:config', configStub);
});
it('generates the correct preview URL with a prefix', async function () {
await render(hbs`
{{gh-url-preview
prefix="tag"
slug="test-slug"
tagName="p"
classNames="test-class"}}`);
expect(this.element).to.have.trimmed.text('my-ghost-blog.com/tag/test-slug/');
});
it('generates the correct preview URL without a prefix', async function () {
await render(hbs`
{{gh-url-preview
slug="test-slug"
tagName="p"
classNames="test-class"}}`);
expect(this.element).to.have.trimmed.text('my-ghost-blog.com/test-slug/');
});
});