katipokkinen / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

function reported as 'not a function' #366

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
apologies if there is a 

What steps will reproduce the problem?
1. Javascript code 

MyClass = function(value) {
    "use strict";

    this.value = value;

}

MyClass.prototype.constructor = Bar

MyClass.prototype.setValue = function (value) {
    "use strict";
    this.value = value;
};

2. Test code

MyClassTest = TestCase("MyClass");

MyClassTest.prototype.testAddValue = function() {
  jstestdriver.console.log("MyClassTest.addValue Test");
  expectAsserts(2);
  var myClass = new MyClass();
  assertEquals(null, myClass.value);  // <-- works

  myClass.addValue("Test"); // <-- can find function
  assertEquals("Test", myClass.value);
};

3.  run tests

What is the expected output? What do you see instead?

Expect 2nd test to find and test the method.

Result: 

Testing started at 9:53 AM ...
[LOG] MyClassTest.addValue Test
TypeError: myClass.addValue is not a function
()@http://localhost:9876/test/tests/bug.js:9

What version of the product are you using? On what operating system?

jsTestRunner included with WebStorm 4.0 which is 1.3.4a
OS/X 10.7.3

Please provide any additional information below.

Original issue reported on code.google.com by r...@buskens.ca on 22 Apr 2012 at 2:58

Attachments:

GoogleCodeExporter commented 8 years ago
Ah, you do realize that the  class defines setValue, and you call addValue?

And what do you mean by second test?  Please reopen with a clearer reproduction.

Original comment by corbinrs...@gmail.com on 22 Apr 2012 at 3:17