fix: valider data.user/data.artistes avant déréférencement
This commit is contained in:
@@ -59,4 +59,15 @@ describe('artiste.create', () => {
|
||||
|
||||
expect(artisteDocuments.create).toHaveBeenCalled()
|
||||
})
|
||||
|
||||
it('refuse sans planter quand data.user est absent', async () => {
|
||||
const {strapi} = buildStrapi({dbUser})
|
||||
const controller = createController({strapi})
|
||||
const ctx = buildCtx(buildData({user: undefined}))
|
||||
|
||||
await controller.create(ctx)
|
||||
|
||||
expect(ctx.badRequest).toHaveBeenCalled()
|
||||
expect(strapi.documents).not.toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user