title: knockout - unit testing computed observables
body: <p>In knockout, i want to unit test the value of a computed observable that depends on another observable, using jasmine. </p>
  
  <p>However, it doesn't work, as the value of the computed observable doesn't update when i change the other observable.</p>
  
  <p>Here is my (simplified) view model:</p>
  
  <pre><code>function MarkersViewModel() {
      var self = this;   
      self.name = ko.observable("chad");
      self.computedName = ko.computed(function() {
          return self.name();
  });
  </code></pre>
  
  <p>Here is my jasmine spec:</p>
  
  <pre><code>describe("string", function() {
      var view_model = new MarkersViewModel();
      view_model.name = ko.observable("joe");
  
      it("returns the whole array when there is no filter", function() {
          expect(view_model.computedName()).toBe("joe");
      });
  });
  </code></pre>
  
  <p>When i run this, jasmine fails:</p>
  
  <pre><code>Expected 'chad' to be 'joe'.
  </code></pre>
  
  <p>Any idea on how i could implement that?</p>
  
  <p>Thanks</p>