Skip to content

Commit

Permalink
#148 FIX: corrige nome e teste
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasgbezerra committed Jul 4, 2023
1 parent d167b2d commit 1aacace
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/domain/entities/serviceOrderEnum/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ export enum Status {
MAINTENANCE = 'Em manuntenção',
WARRANTY = 'Garantia',
CONCLUDED = 'Concluido',
FINESHED = 'Finalizado',
FINISHED = 'Finalizado',
CANCELED = 'Cancelado'
}
4 changes: 2 additions & 2 deletions src/useCases/update-order-service/update-order-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class UpdateOrderServiceUseCase
})

if (
this.handleOSStatus(data.status) === OSStatus.FINESHED ||
this.handleOSStatus(data.status) === OSStatus.FINISHED ||
this.handleOSStatus(data.status) === OSStatus.CANCELED
) {
await this.updateEquipmentRepository.updateEquipment(equipment.id, {
Expand Down Expand Up @@ -107,7 +107,7 @@ export class UpdateOrderServiceUseCase
return OSStatus.CONCLUDED
}
case 'FINISHED': {
return OSStatus.FINESHED
return OSStatus.FINISHED
}
case 'CANCELED': {
return OSStatus.CANCELED
Expand Down
18 changes: 16 additions & 2 deletions tests/update-order-service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,20 @@ describe('Test update order use case', () => {
status: 'CONCLUDED' as OSStatus
}

const dataFinished: UpdateOrderServiceUseCaseData = {
id: 2,
equipmentId: 'equipment_id',
description: 'any_description',
seiProcess: '123456789',
senderPhone: '61992809831',
senderDocument: '12345678910',
technicianId: '123456',
technicianName: 'Pessoa',
withdrawalName: 'Recebedor',
withdrawalDocument: '98765432198',
status: 'FINISHED' as OSStatus
}

const dataCanceled: UpdateOrderServiceUseCaseData = {
id: 2,
equipmentId: 'equipment_id',
Expand Down Expand Up @@ -188,8 +202,8 @@ describe('Test update order use case', () => {
})
})

test('should call updateEquipmentRepository if order service status was updated to concluded', async () => {
const result = await updateOrderServiceUseCase.execute(dataConcluded)
test('should call updateEquipmentRepository if order service status was updated to finished', async () => {
const result = await updateOrderServiceUseCase.execute(dataFinished)

expect(updateEquipmentRepository.updateEquipment).toBeCalledTimes(1)
expect(updateEquipmentRepository.updateEquipment).toBeCalledWith(
Expand Down

0 comments on commit 1aacace

Please sign in to comment.