У меня есть контроллер в Nest. JS, который перенаправляет:
@Get('route/:value')
async route(@Param('value') value: string) {
const result = await this.someService.doSomethingWithValue(value);
if (result) {
return { url: 'http://example.com/success.html' };
} else {
return { url: 'http://example.com/fail.html' };
}
}
Как мне проверить в controller.spe c .ts правильный ответ на перенаправление? т.е.:
describe('test', () => {
it('should show success page', async() => {
service.doSomethingWithValue = jest.fn(() => Promise.resolve(true));
expect(controller.route('value')).toBe(?????);
});
});