Skip to content

Commit

Permalink
fix: fields format and infos of `PATCH /admin/tournaments/:tournament…
Browse files Browse the repository at this point in the history
…Id` can now be empty strings (#227)
  • Loading branch information
TeddyRoncin authored Sep 5, 2024
1 parent de0d447 commit b2cf44f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/controllers/admin/tournaments/updateTournament.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ export default [
name: Joi.string().optional(),
maxPlayers: Joi.number().optional(),
cashprize: Joi.number().optional(),
cashprizeDetails: Joi.string().optional(),
cashprizeDetails: Joi.string().allow('').optional(),
displayCashprize: Joi.boolean().optional(),
format: Joi.string().optional(),
infos: Joi.string().optional(),
format: Joi.string().allow('').optional(),
infos: Joi.string().allow('').optional(),
casters: Joi.array().items(Joi.string()).optional(),
displayCasters: Joi.boolean().optional(),
display: Joi.boolean().optional(),
Expand Down
8 changes: 8 additions & 0 deletions tests/admin/tournaments/updateTournament.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,12 @@ describe('PATCH /admin/tournaments/{tournamentId}', () => {
const tournamentDatabase = await tournamentOperations.fetchTournament(tournament.id);
expect(tournamentDatabase.maxPlayers).to.equal(validBody.maxPlayers);
});

it('should allow for empty strings in fields `format` and `infos`', async () => {
await request(app)
.patch(`/admin/tournaments/${tournament.id}`)
.send({ format: '', infos: '' })
.set('Authorization', `Bearer ${adminToken}`)
.expect(200);
});
});

0 comments on commit b2cf44f

Please sign in to comment.