我对 Angular 和 Jasmine 测试相当陌生,所以我试图检查这个方法是否正常工作,但我需要模拟XmlReaderService,它仅在本地使用,我如何模拟这个?我期待一些东西,spyOn但无法理解它...... private getElementSettings() { const xmlReader = new XmlReaderService(this.logger) xmlReader.requestXml(this.xmlServiceUrl + this.settingsFileName).then(() => { this.elementSettings = xmlReader.xmlJsoned['element_settings'] this.getElementTypes() this.getElementList() this.getMonitors() }).catch((reason) => { this.logger.error('XML Request failed in getElementSettings()!') this.logger.info(reason, '[' + this.constructor.name + ']') this.delegate.errorCallback(650, 'XML Request failed - could not get smart home element definitions (ElementSettings.xml)', reason) }) }
添加回答
举报
0/150
提交
取消