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

🐛 Fixed API errors when including member counts for labels

closes https://github.com/TryGhost/Team/issues/607

- patch was added in `bookshelf-include-count@0.1.3` to fix member counts for labels
- bumps `bookshelf-plugins` to include the patch
This commit is contained in:
Rishabh 2021-07-09 19:51:17 +05:30
parent eaaced1941
commit 6bb10e6d4b
2 changed files with 19 additions and 1 deletions

View file

@ -52,7 +52,7 @@
"@sentry/node": "6.8.0",
"@tryghost/adapter-manager": "0.2.14",
"@tryghost/admin-api-schema": "2.5.0",
"@tryghost/bookshelf-plugins": "0.1.3",
"@tryghost/bookshelf-plugins": "0.1.4",
"@tryghost/bootstrap-socket": "0.2.9",
"@tryghost/config-url-helpers": "0.1.0",
"@tryghost/constants": "0.1.8",

View file

@ -44,4 +44,22 @@ describe('Labels API', function () {
should.exist(res.headers.location);
res.headers.location.should.equal(`http://127.0.0.1:2369${localUtils.API.getApiQuery('labels/')}${res.body.labels[0].id}/`);
});
it('Can browse with member count', async function () {
const res = await request
.get(localUtils.API.getApiQuery('labels/?include=count.members'))
.set('Origin', config.get('url'))
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);
should.not.exist(res.headers['x-cache-invalidate']);
const jsonResponse = res.body;
should.exist(jsonResponse);
should.exist(jsonResponse.labels);
jsonResponse.labels.should.have.length(1);
should.exist(jsonResponse.labels[0].count);
jsonResponse.labels[0].count.members.should.equal(0);
});
});