尝试验证数据库查询的超时,但无法通过 HttpTestingController 实现。
不确定如何设计 UT。在这个设置中,应该在哪里添加超时。
it('test timeout', () => {
service.getData('2025-10-12', '2025-10-16').subscribe(
{
next: data => {
expect(data).not.toBeNull();
},
error: error => {
expect(error).toBeNull(); // handling all missing keys
}
}
);
// mocking endpoint - binding
const response = httpController.expectOne({
method: 'GET',
url: RestServerSA.RELEASES_OVERVIEW_RANGE
});
// mocking response from endpoint
response.flush({});
});