title: jasmine test on route.data.subscribe()
body: <p>I have a component with 2 methods below. </p>
  
  <p>How to test on ngOnInit() that method nameList() to haveBeenCalledWith(students)</p>
  
  <pre><code>constructor(route: ActivatedRoute, location: Location) { 
  }
  
  ngOnInit() {
      this.route.data
      subscribe((data: { students: Students }) =&gt; {
         const students: Students = data.students;
         this.nameList(students);
      });
  }
  
  nameList(students: Student) {
    .....
  }
  </code></pre>
  
  <p>What I have so far :</p>
  
  <pre><code>describe('ngOnInit', () =&gt; {
      it('should extract data from route', () =&gt; {
  
        component = fixture.componentInstance;
  
        spyOn(component.route.data, 'subscribe').and.callFake((data: { students: Students }) =&gt; { } );
        component.ngOnInit();
        fixture.detectChanges();
  
        expect(component.nameList).toHaveBeenCalledWith(students);
  
      });
    });
  </code></pre>