title: jasmine - How to do equality comparison between function and object method assigned with .bind?
body: <p><strong>Edit: My original question did not include <code>.bind</code> in funcToTest. That appears to be what's failing the test.</strong></p>
  
  <p>I am testing a method that assigns a function to an object's property.</p>
  
  <p>I want to verify that the newly created property equals the function. Neither <code>toBe</code> nor <code>toEqual</code> are getting the test to pass.</p>
  
  <p>What's best practice in this case?</p>
  
  <pre><code>class TestClass {
      constructor() {
      }
  
      initMyObj() {
          this.myObj = {
              func: this.myFunc.bind(this) //it works fine without .bind
          }
      }
  
      funcToTest() {
          console.log('Thanks for reading!');
      }
  }
  
  
  describe('TestClass', function() {
      beforeEach(function() {
          this.test = new TestClass();
      });
      it('should set "myObj.func" property to funcToTest method', function() {
          this.test.initMyObj();
          expect(this.test.myObj.func).toBe(this.test.funcToTest); //fails with `Expected Function to be Function.`
          expect(this.test.myObj.func).toEqual(this.test.funcToTest); //fails with `Expected Function to equal Function.`
      })
  })
  </code></pre>
  
  <p>Also note - if I remove <code>.bind(this)</code>, it works fine.</p>