<commit_before><commit_msg>add test for the schemas route w\ @heitorsilva<commit_after>const request = require('supertest');

const routes = require('../../../../lib/http/routes');
const schemas = require('../../../../lib/domain/schemas');

describe('GET /_schema/:schema', () => {
  describe('when schema is equals root', () => {
    it('should returns the schema for root properly', (done) => {
      request(routes)
        .get('/_schemas/root')
        .expect('content-type', /json/)
        .expect(200, schemas.root, done);
    });
  });

  describe('when schema is equals functions/list', () => {
    it('should returns the schema for functions list', (done) => {
      request(routes)
        .get('/_schemas/functions/list')
        .expect('content-type', /json/)
        .expect(200, schemas['functions/list'], done);
    });
  });

  describe('when schema is equals functions/item', () => {
    it('should returns the schema for function item', (done) => {
      request(routes)
        .get('/_schemas/functions/item')
        .expect('content-type', /json/)
        .expect(200, schemas['functions/item'], done);
    });
  });

  describe('when schema does not exist in functions', () => {
    it('should returns schema not found', (done) => {
      request(routes)
        .get('/_schemas/functions/foobar')
        .expect('content-type', /json/)
        .expect(404, { error: 'Schema not found' }, done);
    });
  });
});
{'fraction_non_alphanumeric': 0.19569743233865372, 'fraction_numerical': 0.008327550312283136, 'mean_word_length': 2.774869109947644, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '664174', 'n_tokens_mistral': 432, 'n_tokens_neox': 419, 'n_words': 101}