<commit_before>'use strict';

var chai = require('chai');
var expect = chai.expect;
var express = require('express');
var app = express();
var http = require('http');
var entityRouter = require('../../').entities.entityRouter;

describe('back4app-rest entityRouter', function () {
  var server;

  after(function () {
    server.close();
  });

  it('should create a router', function (done) {
    var router = entityRouter({
      test: {
        Entity: {name: 'test'}
      }
    }, 'DummyToken');

    app.use('/api', router);

    server = app.listen(3000, function () {
      var port = server.address().port;
      expect(port).to.equal(3000);
      yo();
    });

    function yo() {
      var req = http.request({
        host: 'localhost',
        port: '3000',
        path: '/api/test',
        method: 'GET'
      }, function (response) {
        expect(response.statusCode).to.equal(200);
        var body = '';
        response.on('data', function (d) { body += d; });
        response.on('end', function () {
          var responseObj = JSON.parse(body);
          expect(responseObj.name).to.equal('test');
          done();
        });
      });
      req.end();
    }

  });
});
<commit_msg>Fixes the test, removing temporary function.<commit_after>'use strict';

var chai = require('chai');
var expect = chai.expect;
var express = require('express');
var app = express();
var http = require('http');
var entityRouter = require('../../').entities.entityRouter;

describe('back4app-rest entityRouter', function () {
  var server;

  before(function (done) {
    server = app.listen(3000, function () {
      var port = server.address().port;
      expect(port).to.equal(3000);
      done();
    });
  });

  after(function () {
    server.close();
  });

  it('should create a router', function (done) {
    var router = entityRouter({
      test: {
        Entity: {name: 'test'}
      }
    }, 'DummyToken');

    app.use('/api', router);

    var req = http.request({
      host: 'localhost',
      port: '3000',
      path: '/api/test',
      method: 'GET'
    }, function (response) {
      expect(response.statusCode).to.equal(200);
      var body = '';
      response.on('data', function (d) { body += d; });
      response.on('end', function () {
        var responseObj = JSON.parse(body);
        expect(responseObj.name).to.equal('test');
        done();
      });
    });
    req.end();




  });
});

{'fraction_non_alphanumeric': 0.18469765528589058, 'fraction_numerical': 0.01316330728095434, 'mean_word_length': 2.4545454545454546, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2095095', 'n_tokens_mistral': 768, 'n_tokens_neox': 730, 'n_words': 169}