mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-03 03:55:26 +03:00
a85f5fae35
no issue - fix lint errors in lib/gh-koenig - fix ghost:base eslint errors - update ember plugin refs, remove ember-suave plugin refs - remove old jshint refs - add `lint:js` script - switch to `eslint-plugin-ghost` extending `plugin:ghost/ember`
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
import Pretender from 'pretender';
|
|
import hbs from 'htmlbars-inline-precompile';
|
|
import wait from 'ember-test-helpers/wait';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupComponentTest} from 'ember-mocha';
|
|
|
|
describe('Integration: Component: gh-download-count', function () {
|
|
setupComponentTest('gh-download-count', {
|
|
integration: true
|
|
});
|
|
|
|
let server;
|
|
|
|
beforeEach(function () {
|
|
server = new Pretender();
|
|
server.get('https://count.ghost.org/', function () {
|
|
return [200, {}, JSON.stringify({count: 42})];
|
|
});
|
|
});
|
|
|
|
afterEach(function () {
|
|
server.shutdown();
|
|
});
|
|
|
|
it('hits count endpoint and renders', function () {
|
|
this.render(hbs`{{gh-download-count}}`);
|
|
|
|
return wait().then(() => {
|
|
expect(this.$().text().trim()).to.equal('42');
|
|
});
|
|
});
|
|
|
|
it('renders with a block', function () {
|
|
this.render(hbs`
|
|
{{#gh-download-count as |count|}}
|
|
{{count}} downloads
|
|
{{/gh-download-count}}
|
|
`);
|
|
|
|
return wait().then(() => {
|
|
expect(this.$().text().trim()).to.equal('42 downloads');
|
|
});
|
|
});
|
|
});
|