我对 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)
})
}
幕布斯6054654
相关分类