我需要知道如何编写与Angular 5中的异步/等待功能(与STT服务的后台服务连接)的单元测试。有人可以帮忙吗?
async listen(){
let data = await fetch('http://localhost:13005/getGoogleText', {
method: 'GET'
})
.then(function(response) {
if (response.ok) {
return response.json();
}
})
.then(response => {
return response;
})
.catch(error => {
return (error);
console.error(error);
});
}