-
-
Notifications
You must be signed in to change notification settings - Fork 406
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Current
In sta, generated Api class is using arrow function
when compile to js, the code will be like this
which has an empty prototype, will unable to modify prototype of Api class for testing or monkey patching.
For example, i am writing unit testing, I am not able to use jest.spyOn(api.prototype,'someApi')
as it will throw no property on prototype, but have to mock import to replace entire class import like
const spy = jest.fn()
jest.mock('../path/to/sta',()=>{
return {
api: function(){
return {
someApi: spy
}
}
}
})
Expected
Using function expression in class, for example
compiled to
which have a modifiable prototype
snipervld and caoimhebyrne
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request