<commit_before>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';

import { LineSplittingPipe } from '../../shared/line-splitting.pipe';
import { AlbumService } from '../album.service';
import { MockAlbumService } from '../mocks/mock-album.service';
import { TitleService } from '../../shared/title.service';
import { MockTitleService } from '../../shared/mocks/mock-title.service';
import { PageHeroComponent } from '../../shared/page-hero/page-hero.component';

import { AlbumListComponent } from './album-list.component';

describe('AlbumListComponent', () => {
  const mockAlbumService = new MockAlbumService();
  const mockTitleService = new MockTitleService();
  let component: AlbumListComponent;
  let fixture: ComponentFixture<AlbumListComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      imports: [ RouterTestingModule ],
      declarations: [ LineSplittingPipe, PageHeroComponent, AlbumListComponent ],
      providers: [
        { provide: AlbumService, useValue: mockAlbumService },
        { provide: TitleService, useValue: mockTitleService }
      ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(AlbumListComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should load albums on component initialization', () => {
    spyOn(mockAlbumService, 'getAllAlbumInfo');
    expect(component.albums.length).toBe(1);
  });

  it('should set title', () => {
    expect(mockTitleService.mockTitle).toBe('All albums');
  });
});
<commit_msg>Update unit tests for album list component<commit_after>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { Observable } from 'rxjs/Observable';

import { It, Mock, Times } from 'typemoq';

import { LineSplittingPipe } from '../../shared/line-splitting.pipe';
import { AlbumService } from '../album.service';
import { TitleService } from '../../shared/title.service';
import { PageHeroComponent } from '../../shared/page-hero/page-hero.component';

import { AlbumListComponent } from './album-list.component';
import { AlbumInfo } from '../album-info';

const mockAlbumData = [{
  albumId: 1,
  title: 'title',
  name: 'name',
  description: 'description',
  imagesInAlbum: 8,
  imagesPerPage: 4,
  totalPages: 2,
  iconUrl: 'http://url/jpg.jpg'
}];

describe('AlbumListComponent', () => {
  const mockAlbumService = Mock.ofType<AlbumService>();
  mockAlbumService.setup(s => s.getAllAlbumInfo())
    .returns(() => Observable.of(mockAlbumData));

  const mockTitleService = Mock.ofType<TitleService>();
  mockTitleService.setup(x => x.setTitle(It.isAnyString()));

  let component: AlbumListComponent;
  let fixture: ComponentFixture<AlbumListComponent>;

  beforeEach(() => {
    mockTitleService.reset();

    TestBed.configureTestingModule({
      imports: [ RouterTestingModule ],
      declarations: [ LineSplittingPipe, PageHeroComponent, AlbumListComponent ],
      providers: [
        { provide: AlbumService, useFactory: () => mockAlbumService.object },
        { provide: TitleService, useFactory: () => mockTitleService.object }
      ]
    })
    .compileComponents();

    fixture = TestBed.createComponent(AlbumListComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should load albums on component initialization', () => {
    expect(component.albums.length).toBe(1);
  });

  it('should set title', () => {
    mockTitleService.verify(x => x.setTitle(It.isValue('All albums')), Times.once());
  });
});

{'fraction_non_alphanumeric': 0.15192255982791072, 'fraction_numerical': 0.0016133369185264857, 'mean_word_length': 4.261669024045261, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5758928', 'n_tokens_mistral': 1077, 'n_tokens_neox': 1047, 'n_words': 216}