javascript - Cannot assign to read only property '.js' of #<Object> -
i m building application , having troubles dealing proxyquire , testing.
i have following test :
import proxyquire 'proxyquire' const fetchmock = () => new promise((res) => {   jobs: [] }) const jenkinsservice = proxyquire('../lib/jenkins-service', {   'node-fetch': fetchmock })  describe('jenkinsservice#getproject->goodconfs', () => {       let service       beforeeach(() => service = new jenkinsservice({         url: 'http://jenkins.io'       }))        it('should call fetch method', () => {         service.getall()       })     })   that fails , throw me following error :
cannot asign read property '.js' of #
i m trying test fetch module has been called in getall method :
'use babel' import fetch 'node-fetch' import constants './constants'  export default class jenkinsservice {    /**    * create new jenkinsservice    * @param  {object} configs configuration needed access jenkins    */   constructor (configs) {     this.configs = configs   }    /**    * remote list of projects    * @return {object[]} project list    */   getall () {     if (!this.configs.url) throw new error(constants.no_url_in_confs)     return fetch(this.configs.url)   } }   any idea what's going wrong ?
 
 
  
Comments
Post a Comment