<commit_before>var chai = require("chai");
var expect = chai.expect;
var sinon = require("sinon");
var startChallenge = require("../start-challenge.js");

describe("start challenge - first web page", function () {
  it("should return 200 OK", function () {
    var res = {writeHead: sinon.spy(), end: sinon.spy()};
    startChallenge.firstWebPage({}, res);

    expect(res.writeHead.args[0][0]).to.equal(200);
  });

  it("should return a response containing 'Hello Yose'", function () {
    var res = {writeHead: sinon.spy(), end: sinon.spy()};
    startChallenge.firstWebPage({}, res);

    var responseBody = res.end.args[0][0];
    expect(responseBody).to.contain("Hello Yose");
  });
});<commit_msg>redid the test so it starts an httpserver and asserts on it.<commit_after>var http = require("http");
var chai = require("chai");
var expect = chai.expect;
var router = require("../router.js");

describe("start challenge - first web page", function () {
  var testServer = http.createServer(router.onRequest).listen(5001);
  testServer.on("close", function() { console.log("end of server"); });

  it("should return 200 OK", function () {
    http.get("http://localhost:5001", function(res) {
      expect(res.statusCode).equal(200);
    });
  });

  it("should return a response containing 'Hello Yose'", function () {
    http.get("http://localhost:5001", function(res) {
      res.once('data', function (chunk) {
        expect(chunk.toString()).contain("Hello Yose");
      });
    });
  });

});
{'fraction_non_alphanumeric': 0.18550531914893617, 'fraction_numerical': 0.018617021276595744, 'mean_word_length': 4.119047619047619, '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': '2734758', 'n_tokens_mistral': 497, 'n_tokens_neox': 469, 'n_words': 113}