0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Improved tests for "include=posts.count" query parameter

refs #12167

- Updated tests to check for concrete post counts numbers. This would allow catching more regression bugs in the future
- Made sure check is performed consistently in tests where posts.count
parameter is present
This commit is contained in:
Nazar Gargol 2020-08-31 17:29:58 +12:00
parent 55aab9063d
commit 791bcc6adb
2 changed files with 5 additions and 0 deletions

View file

@ -49,6 +49,7 @@ describe('Tag API', function () {
jsonResponse.tags[1].url.should.eql(`${config.get('url')}/tag/kitchen-sink/`);
should.exist(jsonResponse.tags[0].count.posts);
jsonResponse.tags[0].count.posts.should.equal(1);
});
});
@ -79,6 +80,7 @@ describe('Tag API', function () {
jsonResponse.tags.should.have.length(1);
localUtils.API.checkResponse(jsonResponse.tags[0], 'tag', ['count', 'url']);
should.exist(jsonResponse.tags[0].count.posts);
jsonResponse.tags[0].count.posts.should.equal(7);
jsonResponse.tags[0].url.should.eql(`${config.get('url')}/tag/getting-started/`);
});

View file

@ -149,6 +149,9 @@ describe('User API', function () {
jsonResponse.users.should.have.length(1);
localUtils.API.checkResponse(jsonResponse.users[0], 'user', ['roles', 'count']);
localUtils.API.checkResponse(jsonResponse.users[0].roles[0], 'role', ['permissions']);
should.exist(jsonResponse.users[0].count.posts);
jsonResponse.users[0].count.posts.should.equal(0);
done();
});
});