Skip to content

Commit ce55cda

Browse files
feat: should return 400 if denuncia.descricao is not provider
1 parent b61e95a commit ce55cda

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tests/presentation/controllers/occurrence/AddOccurrenceController.spec.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,22 @@ describe('Unit Test: AddOccurrenceController', () => {
133133
it('should return 400 and InvalidRequestError if denuncia.titulo is not provider', async () => {
134134
const { sut } = makeSut();
135135
const httpRequest = makeHttpRequestMock();
136-
delete httpRequest.body.denuncia;
136+
delete httpRequest.body.denuncia.titulo;
137+
138+
const httpResponse = await sut.handle(httpRequest);
139+
140+
expect(httpResponse.statusCode).toBe(400);
141+
142+
expect(httpResponse.body).toEqual({
143+
code: '01',
144+
message: 'Request inválido.',
145+
});
146+
});
147+
148+
it('should return 400 and InvalidRequestError if denuncia.descricao is not provider', async () => {
149+
const { sut } = makeSut();
150+
const httpRequest = makeHttpRequestMock();
151+
delete httpRequest.body.denuncia.descricao;
137152

138153
const httpResponse = await sut.handle(httpRequest);
139154

0 commit comments

Comments
 (0)