<commit_before>'use strict';

var request = require('supertest')
  , express = require('express')

  , should = require('chai').should()

  , clientele = require('../../index');

exports.test = function(name){
  var data = require('../fixtures/data');

  describe(name, function(){
    var app, server;

    before(function(done){
      app = express();
      app.use(clientele[name]());
      app.use(app.router);

      app.get('/connection-test', function(req, res){
        res.send(200, {
          succeeded: true
        });
      });

      var port = 3003;

      server = require('http').createServer(app);
      server.listen(port, function(){
        request = request('http://localhost:' + port);
        done();
      });
    });

    it('connects to the testing server', function(done){
      should.exist(app);
      request
        .get('/connection-test')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200)
        .end(function(err, res){
          if(err || !res.body.succeeded){
            throw err;
          }
          done();
        });
    });
  });
};
<commit_msg>New test.<commit_after>'use strict';

var request = require('supertest')
  , express = require('express')

  , should = require('chai').should()

  , clientele = require('../../index')
  , path = require('path');

exports.test = function(name){
  var data = require('../fixtures/data');

  describe(name, function(){
    var app, server, window;

    before(function(done){
      app = express();
      app.use(clientele[name](path.join(__dirname, '..', 'fixtures')));
      app.use(app.router);

      app.get('/connection-test', function(req, res){
        res.send(200, {
          succeeded: true
        });
      });

      var port = 3003;

      server = require('http').createServer(app);
      server.listen(port, function(){
        request = request('http://localhost:' + port);
        done();
      });
    });

    it('connects to the testing server', function(done){
      should.exist(app);

      request
        .get('/connection-test')
        .set('Accept', 'application/json')
        .expect('Content-Type', /json/)
        .expect(200)
        .end(function(err, res){
          if(err || !res.body.succeeded){
            throw err;
          }
          done();
        });
    });

    it('mounts a renderer at the endpoint', function(done){
      should.exist(app);

      window = {};
      request
        .get('/js/templates.js')
        .expect(200)
        .end(function(err, res){
          if(err){
            throw err;
          }
          eval(res);
          should.exist(window[name]);
        });
    });

    it('properly performs a client render');
    it('properly performs a synchronous client render');
  });
};

{'fraction_non_alphanumeric': 0.17848236551478447, 'fraction_numerical': 0.008193801211257571, 'mean_word_length': 2.0789473684210527, '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': '5176776', 'n_tokens_mistral': 854, 'n_tokens_neox': 812, 'n_words': 163}