Ghost/ghost/admin/tests/integration/components/gh-download-count-test.js
Kevin Ansfield a85f5fae35 Switch to eslint-plugin-ghost extending plugin:ghost/ember
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`
2018-01-12 12:17:56 +00:00

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');
});
});
});