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:
parent
6c35de7d95
commit
7b950f6382
1 changed files with 31 additions and 0 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue