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

import { TitleService } from '../shared/title.service';
import { MockTitleService } from '../shared/mocks/mock-title.service';

import { PageHeroComponent } from '../shared/page-hero/page-hero.component';

import { ErrorComponent } from './error.component';

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

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

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

  it('should create and show 404 text', () => {
    expect(component).toBeTruthy();

    const compiled = fixture.debugElement.nativeElement;
    expect(compiled.querySelector('.basic-card > h2').textContent)
      .toContain('Feeling lost? Don’t worry');
  });

  it('should reset title', () => {
    expect(mockTitleService.mockTitle).toBe('');
  });
});<commit_msg>Update mock usage for error component test<commit_after>import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';

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

import { TitleService } from '../shared/title.service';
import { PageHeroComponent } from '../shared/page-hero/page-hero.component';

import { ErrorComponent } from './error.component';

describe('ErrorComponent', () => {
  const mockTitleService = Mock.ofType<TitleService>();
  mockTitleService.setup(x => x.setTitle(It.isAnyString()));
  mockTitleService.setup(x => x.resetTitle());

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

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

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

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

  it('should create and show 404 text', () => {
    expect(component).toBeTruthy();

    const compiled = fixture.debugElement.nativeElement;
    expect(compiled.querySelector('.basic-card > h2').textContent)
      .toContain('Feeling lost? Don’t worry');
  });

  it('should reset title', () => {
    mockTitleService.verify(s => s.resetTitle(), Times.once());
  });
});
{'fraction_non_alphanumeric': 0.1453020134228188, 'fraction_numerical': 0.0026845637583892616, 'mean_word_length': 3.9029605263157894, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 21, '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': '2217400', 'n_tokens_mistral': 841, 'n_tokens_neox': 824, 'n_words': 165}