Wrong type of error when testing javascript function -


i trying test following code:

  /** abstract method placeholder */ myresult.prototype.get = thrownotimplementederror;  function thrownotimplementederror(resultid) {     throw new notimplementederror('please implement in item groups , items. call abstract'); } 

with following test.

it('should have placeholder get', function(){     expect(function(){return myresult.get(123);}).tothrowerror(notimplementederror); }); 

what ends happenining typeerror thrown instead of custom notimplementederror. type error's message is: "myresult.get not function".

i'm wondering if might have calling variable in prototype 'get' think i've seen examples name javascript classes , use custom method call get. seems work other calls.

do have advice on why doesn't work call?

it's prototype function

so have test get function instance of object this:

it('should have placeholder get', function(){     var resultobj = new myresult(); // create instance of object     expect(function(){return resultobj.get(123);}).tothrowerror(notimplementederror); }); 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -