<commit_before>import { createEmptyContext } from '@foal/core';
import { expect } from 'chai';

import { ViewService } from '../services';
import { view, ViewControllerFactory } from './view.controller-factory';

describe('view', () => {

  let mock: ViewService;

  before(() => {
    mock = {
      render: (locals: { name: string }): string => {
        return locals.name || 'bar';
      }
    };
  });

  it('should be an instance of ViewControllerFactory', () => {
    expect(view).to.an.instanceOf(ViewControllerFactory);
  });

  describe('when getRoutes(service: ViewService): Route[] is called with the mock service', () => {

    it('should return the proper Route array.', () => {
      const actual = view.getRoutes(mock);
      expect(actual).to.be.an('array').and.to.have.lengthOf(1);

      const actualItem = actual[0];
      const ctx = createEmptyContext();
      expect(actualItem.middleware(ctx)).to.equal('bar');
      ctx.state.locals = { name: 'foo' }
      expect(actualItem.middleware(ctx)).to.equal('foo');
      expect(actualItem.serviceMethodName).to.equal('render');
      expect(actualItem.httpMethod).to.equal('GET');
      expect(actualItem.path).to.equal('/');
      expect(actualItem.successStatus).to.equal(200);
    });

  });

});<commit_msg>Fix linting<commit_after>import { createEmptyContext } from '@foal/core';
import { expect } from 'chai';

import { ViewService } from '../services';
import { view, ViewControllerFactory } from './view.controller-factory';

describe('view', () => {

  let mock: ViewService;

  before(() => {
    mock = {
      render: (locals: { name: string }): string => {
        return locals.name || 'bar';
      }
    };
  });

  it('should be an instance of ViewControllerFactory', () => {
    expect(view).to.an.instanceOf(ViewControllerFactory);
  });

  describe('when getRoutes(service: ViewService): Route[] is called with the mock service', () => {

    it('should return the proper Route array.', () => {
      const actual = view.getRoutes(mock);
      expect(actual).to.be.an('array').and.to.have.lengthOf(1);

      const actualItem = actual[0];
      const ctx = createEmptyContext();
      expect(actualItem.middleware(ctx)).to.equal('bar');
      ctx.state.locals = { name: 'foo' };
      expect(actualItem.middleware(ctx)).to.equal('foo');
      expect(actualItem.serviceMethodName).to.equal('render');
      expect(actualItem.httpMethod).to.equal('GET');
      expect(actualItem.path).to.equal('/');
      expect(actualItem.successStatus).to.equal(200);
    });

  });

});
{'fraction_non_alphanumeric': 0.17936694021101993, 'fraction_numerical': 0.003907776475185619, 'mean_word_length': 3.4599303135888504, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '1695925', 'n_tokens_mistral': 784, 'n_tokens_neox': 761, 'n_words': 147}