Skip to content

Commit 013f6f1

Browse files
Merge pull request nestjs#3583 from tonyhallett/missing_router_execution_test
test(core): add missing test
2 parents ea9b321 + 73de8d7 commit 013f6f1

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

packages/core/test/router/router-execution-context.spec.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,5 +408,30 @@ describe('RouterExecutionContext', () => {
408408
expect(response.redirect.called).to.be.false;
409409
});
410410
});
411+
412+
describe('when replying with result', () => {
413+
it('should call "adapter.reply()" with expected args', async () => {
414+
const result = Promise.resolve('test');
415+
const response = {};
416+
417+
sinon.stub(contextCreator, 'reflectRenderTemplate').returns(undefined);
418+
419+
const handler = contextCreator.createHandleResponseFn(
420+
null,
421+
false,
422+
undefined,
423+
1234,
424+
);
425+
const adapterReplySpy = sinon.spy(adapter, 'reply');
426+
await handler(result, response);
427+
expect(
428+
adapterReplySpy.calledOnceWithExactly(
429+
sinon.match.same(response),
430+
'test',
431+
1234,
432+
),
433+
).to.be.true;
434+
});
435+
});
411436
});
412437
});

0 commit comments

Comments
 (0)