Ghost/ghost/admin/tests/integration/services/store-test.js

41 lines
1.0 KiB
JavaScript
Raw Normal View History

import {expect} from 'chai';
2016-11-24 01:50:57 +03:00
import {describe, it} from 'mocha';
import {setupTest} from 'ember-mocha';
import Pretender from 'pretender';
import config from 'ghost-admin/config/environment';
2016-11-24 01:50:57 +03:00
describe('Integration: Service: store', function () {
setupTest('service:store', {
integration: true
2016-11-24 01:50:57 +03:00
});
2016-11-24 01:50:57 +03:00
let server;
2016-11-24 01:50:57 +03:00
beforeEach(function () {
server = new Pretender();
});
2016-11-24 01:50:57 +03:00
afterEach(function () {
server.shutdown();
});
2016-11-24 01:50:57 +03:00
it('adds Ghost version header to requests', function (done) {
let {version} = config.APP;
let store = this.subject();
server.get('/ghost/api/v0.1/posts/1/', function () {
return [
404,
{'Content-Type': 'application/json'},
JSON.stringify({})
];
});
2016-11-24 01:50:57 +03:00
store.find('post', 1).catch(() => {
let [request] = server.handledRequests;
expect(request.requestHeaders['X-Ghost-Version']).to.equal(version);
done();
});
2016-11-24 01:50:57 +03:00
});
});