Closed hcastellonLan closed 8 years ago
Please highlight your code in the future.
Throw the class
keyword away for now, it's just a distraction here. You started with this:
function Booking () {}
function Booking.get = function get () {}
And then you're trying to stub it with:
{get: function () {}}
Then you try to call bookingStub
as a function with new
and it fails. Make bookingStub
a function and then append your get
method.
thank you very much sorry by the highlight
@bendrucker
i tested the solution but for me is fail again
let bookingStub = () => {};
bookingStub.get = (recordLocator, lastame) => {}
let Booking = proxyquire("../../src/controllers/booking", {
"../clients/booking":bookingStub
});
let bookingController = new Booking();
and the result si the same
TypeError: object is not a function
any idea?
Booking.Booking
would be your constructor since you're nesting under that key
Hello
i have problems loading the es6 object with proxyquire
i have this class
And the dependency
My Test
The problem is than i obtain this message "TypeError: object is not a function" in this line "
let bookingController = new Booking();
i cheked the path and is ok
Exist a problem using babel with class and objects with proxyquire? or other problem than i can't see?
Thank you very much