title: Fix this test: Functional-Reactive Programming Tutorial
body: <p>I'm studying through the tutorial at <a href="http://reactivex.io/learnrx/" rel="nofollow">http://reactivex.io/learnrx/</a>. I'm on <strong>Exercise 19 - Reducing with an Initial Value:</strong> <em>Sometimes when we reduce an array, we want the reduced value to be a different type than the items stored in the array. Let's say we have an array of videos and we want to reduce them to a single map where the key is the video id and the value is the video's title.</em> </p>
  
  <p>As far as the tutorial is concerned, I've solved it:</p>
  
  <pre><code>function exercise19() {
      var videos = [
          {
              "id": 65432445,
              "title": "The Chamber"
          },
          {
              "id": 675465,
              "title": "Fracture"
          },
          {
              "id": 70111470,
              "title": "Die Hard"
          },
          {
              "id": 654356453,
              "title": "Bad Boys"
          }
      ];
  
    return videos.reduce(function(accumulatedMap, video) {
        var copyOfAccumulatedMap = Object.create(accumulatedMap);
        copyOfAccumulatedMap[video.id] = video.title; // &lt;-- My solution
  
        return copyOfAccumulatedMap;
    }, {});
  } // end of overall function
  </code></pre>
  
  <p>To verify your solution you click, "Run." If it runs correctly then you get to move on to the next exercise. I did and it gave me the next exercise. My test suite tells me differently.</p>
  
  <p>While trying to solve it, I created this test:</p>
  
  <pre><code> it("should be able to reduce to an object with id's for keys", function() {
  
      var output = [{
        "65432445": "The Chamber",
        "675465": "Fracture",
        "70111470": "Die Hard",
        "654356453": "Bad Boys"
      }];
  
      expect(exercise19()).toEqual(output);
  
    }); // end it
  </code></pre>
  
  <p>(I got the output from the tutorial.)</p>
  
  <p>The problem I'm having is the test continues to fail: </p>
  
  <blockquote>
    <p>Expected [ Object({ 654356453: 'Bad Boys' }) ] to equal [ Object({
    65432445: 'The Chamber', 675465: 'Fracture', 70111470: 'Die Hard',
    654356453: 'Bad Boys' }) ].</p>
  </blockquote>
  
  <p>So it seems like it's only picking up the final property, the 'bad boys' property, in the test. I'm thinking that, with the way reduce works and Object.create, that the other properties are there, but they're on the prototype. How can I get this test to pass..?</p>
  
  <h1>UPDATE:</h1>
  
  <p>I fixed this in a pull-request. These tutorial no uses Object.assign, instead of Object.create. It is now testable. :-)</p>