0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Added test coverage for members search

no issue

- This test confirms there is no 404 returned when search fails to find any results. It's important to return a 200 in this case as some API clients (e.g. Zapier integration) could treat non-2xx responses as errors
This commit is contained in:
Naz 2020-10-16 13:10:40 +13:00
parent 8ecd6a7c71
commit 34875b85f3

View file

@ -90,6 +90,22 @@ describe('Members API', function () {
});
});
it('Search for non existing member returns empty result set', function () {
return request
.get(localUtils.API.getApiQuery('members/?search=do_not_exist'))
.set('Origin', config.get('url'))
.expect('Content-Type', /json/)
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200)
.then((res) => {
should.not.exist(res.headers['x-cache-invalidate']);
const jsonResponse = res.body;
should.exist(jsonResponse);
should.exist(jsonResponse.members);
jsonResponse.members.should.have.length(0);
});
});
it('Add should fail when passing incorrect email_type query parameter', function () {
const member = {
name: 'test',