mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 23:27:26 +01:00
v3 fix GET /groups: return an error only if an invalid type is supplied not when there are 0 results (#7203)
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
generateUser,
|
||||
resetHabiticaDB,
|
||||
generateGroup,
|
||||
translate as t,
|
||||
} from '../../../../helpers/api-v3-integration.helper';
|
||||
import {
|
||||
TAVERN_ID,
|
||||
@@ -70,6 +71,15 @@ describe('GET /groups', () => {
|
||||
});
|
||||
});
|
||||
|
||||
it('returns error when an invalid ?type query is passed', async () => {
|
||||
await expect(user.get('/groups?type=invalid'))
|
||||
.to.eventually.be.rejected.and.eql({
|
||||
code: 400,
|
||||
error: 'BadRequest',
|
||||
message: t('groupTypesRequired'),
|
||||
});
|
||||
});
|
||||
|
||||
it('returns only the tavern when tavern passed in as query', async () => {
|
||||
await expect(user.get('/groups?type=tavern'))
|
||||
.to.eventually.have.a.lengthOf(1)
|
||||
|
||||
Reference in New Issue
Block a user