I’m trying to write unit tests for my NestJS application using Jest. I have a resolver with a @Query() decorator that I want to test, but I’m not sure how to achieve 100% test coverage for the line that contains the @Query() decorator.
Here is the code for my resolver:
@Resolver(() => Person)
export class MyResolver {
@Query(() => Person, { name: 'personLogged' })
async getPerson(
@Token() tokenPersonLogged: string,
@Context() context,
@Profiles() personProfiles: string[],
): Promise<Person> {
// ...
}
}
Any help would be greatly appreciated!