fix: valider data.user/data.artistes avant déréférencement
This commit is contained in:
@@ -81,4 +81,22 @@ describe('commentaire.create', () => {
|
||||
await expect(controller.create(ctx)).rejects.toThrow('Texte introuvable.')
|
||||
expect(commentaireDocuments.create).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('refuse sans planter quand data.user est absent', async () => {
|
||||
const {strapi, userDbQuery} = buildStrapi()
|
||||
const controller = createController({strapi})
|
||||
const ctx = buildCtx(buildData({user: undefined}))
|
||||
|
||||
await expect(controller.create(ctx)).rejects.toThrow('Informations manquantes.')
|
||||
expect(userDbQuery.findOne).not.toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('refuse sans planter quand data.parole est absent', async () => {
|
||||
const {strapi, paroleDbQuery} = buildStrapi()
|
||||
const controller = createController({strapi})
|
||||
const ctx = buildCtx(buildData({parole: undefined}))
|
||||
|
||||
await expect(controller.create(ctx)).rejects.toThrow('Informations manquantes.')
|
||||
expect(paroleDbQuery.findOne).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user