mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 15:12:58 +03:00
30b2d3a4b3
no issue - Switches over to new v3 endpoint from canary
39 lines
1022 B
JavaScript
39 lines
1022 B
JavaScript
import Pretender from 'pretender';
|
|
import config from 'ghost-admin/config/environment';
|
|
import {describe, it} from 'mocha';
|
|
import {expect} from 'chai';
|
|
import {setupTest} from 'ember-mocha';
|
|
|
|
describe('Integration: Service: store', function () {
|
|
setupTest();
|
|
|
|
let server;
|
|
|
|
beforeEach(function () {
|
|
server = new Pretender();
|
|
});
|
|
|
|
afterEach(function () {
|
|
server.shutdown();
|
|
});
|
|
|
|
it('adds Ghost version header to requests', function (done) {
|
|
let {version} = config.APP;
|
|
let store = this.owner.lookup('service:store');
|
|
|
|
server.get('/ghost/api/v3/admin/posts/1/', function () {
|
|
return [
|
|
404,
|
|
{'Content-Type': 'application/json'},
|
|
JSON.stringify({})
|
|
];
|
|
});
|
|
|
|
store.find('post', 1).catch(() => {
|
|
let [request] = server.handledRequests;
|
|
expect(request.requestHeaders['X-Ghost-Version']).to.equal(version);
|
|
done();
|
|
});
|
|
});
|
|
});
|