fix: valider data.user/data.artistes avant déréférencement

This commit is contained in:
2026-07-04 11:38:02 +04:00
parent c4f45f712a
commit 6f77c17003
6 changed files with 64 additions and 0 deletions
@@ -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()
})
})