[英]how to unit test httpParams in Jasmine
我是單元測試的新手。 我有一個 function 正在設置查詢參數:
setParams(scale): HttpParams {
return this.params = new HttpParams()
.set('scale', scale);
}
output 將權利傳遞給 http 獲取方法。 但我不知道如何測試上面的 function 是否真的給出了 http 參數。 誰能給我一些建議? 謝謝!
類似於以下內容:
it('should set params', () => {
const params = service.setParams('hello'); // I assume this is in the service code
expect(params.get('scale')).toBe('hello');
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.