// the test
const response = await request(app.getHttpServer())
.post('/api/v1/parent-agencies')
.set('Authorization', `Bearer ${token}`)
.send({
name: 'Parent Agency',
});
Expected (which works when running with start:e2e)
@Post()
@UseGuards(PoliciesGuard)
@CheckPolicies((ability) => ability.can(Action.Create, ParentAgencies))
create(
@Body() body: CreateParentAgenciesRequestBody,
): Promise<CreateParentAgenciesResponseData> {
return this.parentAgenciesService.create(body.toModel()); // should work
}
Actual:
TypeError: body.toModel is not a function
I tried logging it both in start:dev mode and test mode and here's the difference:
// start:dev
body CreateParentAgenciesRequestBody { name: 'skibidi' }
// test
body { name: 'Parent Agency'
How do I address this ?