@koalarx/nest-cli
Version:
Biblioteca de CLI para criação de projetos utilizando Koala Nest
25 lines (19 loc) • 757 B
text/typescript
import { createUnitTestApp } from '@/test/create-unit-test-app'
import { createPersonRequestMockup } from '@/test/mockup/person/create-person-request.mockup'
import { CreatePersonHandler } from '../create/create-person.handler'
import { DeletePersonHandler } from './delete-person.handler'
describe('DeletePersonHandler', () => {
const app = createUnitTestApp()
it('should delete a person', async () => {
const createResult = await app
.get(CreatePersonHandler)
.handle(createPersonRequestMockup)
expect(createResult.isOk()).toBeTruthy()
if (createResult.isOk()) {
const result = await app
.get(DeletePersonHandler)
.handle(createResult.value.id)
expect(result.isOk()).toBeTruthy()
}
})
})