0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-03 23:00:14 -05:00

Added test case for includes not being present in response

refs #9866

- Adds a test case checking current filtering behavior for 'include' parameter
This commit is contained in:
Nazar Gargol 2018-09-26 11:55:21 +02:00
parent 6c35de7d95
commit 7b950f6382

View file

@ -186,6 +186,37 @@ describe('Post API', function () {
});
});
it('fields and formats and include ignores include', function (done) {
request.get(testUtils.API.getApiQuery('posts/?formats=mobiledoc,html&fields=id,title&include=authors'))
.set('Authorization', 'Bearer ' + ownerAccessToken)
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200)
.end(function (err, res) {
if (err) {
return done(err);
}
should.not.exist(res.headers['x-cache-invalidate']);
var jsonResponse = res.body;
should.exist(jsonResponse.posts);
should.not.exist(jsonResponse.posts[0].authors);
testUtils.API.checkResponse(jsonResponse, 'posts');
jsonResponse.posts.should.have.length(11);
testUtils.API.checkResponse(
jsonResponse.posts[0],
'post',
null,
null,
['mobiledoc', 'id', 'title', 'html']
);
testUtils.API.checkResponse(jsonResponse.meta.pagination, 'pagination');
done();
});
});
it('can retrieve all published posts and pages', function (done) {
request.get(testUtils.API.getApiQuery('posts/?staticPages=all'))
.set('Authorization', 'Bearer ' + ownerAccessToken)