<commit_before>/* global describe, it*/
/* jslint node: true, esnext: true */

"use strict";

const chai = require('chai'),
  assert = chai.assert,
  expect = chai.expect,
  should = chai.should();
chai.use(require('chai-as-promised'));

const http = require('http');

const kronos = require('kronos-service-manager'),
  service = require('../lib/consulService.js');

const srv = http.createServer(function (req, res) {
  res.writeHead(200, {
    'Content-Type': 'text/plain'
  });

  console.log("got request");

  setTimeout(
    () => res.end('okay'), 500);
  //res.end('okay');
});

srv.listen(8500, '127.0.0.1');

describe('consul service', function () {
  it("create", function (done) {
    kronos.manager().then(
      function (manager) {
        describe('create', function () {
          try {
            require('kronos-koa-service').registerWithManager(manager);
            require('kronos-health-check-service').registerWithManager(manager);
            service.registerWithManager(manager);

            const cs = manager.serviceGet('consul');

            assert.equal(cs.name, "consul");
            assert.equal(cs.state, "starting");

            cs.start().then(f => {
              assert.equal(cs.state, "running");
              console.log(`${JSON.stringify(cs.tags)}`);
              done();
            }, done);
          } catch (err) {
            done(err);
          }
        });
      }
    );
  });<commit_msg>fix: renaming typo<commit_after>/* global describe, it*/
/* jslint node: true, esnext: true */

"use strict";

const chai = require('chai'),
  assert = chai.assert,
  expect = chai.expect,
  should = chai.should();
chai.use(require('chai-as-promised'));

const http = require('http');

const kronos = require('kronos-service-manager'),
  service = require('../lib/consulService.js');

const srv = http.createServer(function (req, res) {
  res.writeHead(200, {
    'Content-Type': 'text/plain'
  });

  console.log("got request");

  setTimeout(
    () => res.end('okay'), 500);
  //res.end('okay');
});

srv.listen(8500, '127.0.0.1');

describe('consul service', function () {
  it("create", function (done) {
    kronos.manager().then(
      function (manager) {
        describe('create', function () {
          try {
            require('kronos-koa-service').registerWithManager(manager);
            require('kronos-service-health-check').registerWithManager(manager);
            service.registerWithManager(manager);

            const cs = manager.serviceGet('consul');

            assert.equal(cs.name, "consul");
            assert.equal(cs.state, "starting");

            cs.start().then(f => {
              assert.equal(cs.state, "running");
              console.log(`${JSON.stringify(cs.tags)}`);
              done();
            }, done);
          } catch (err) {
            done(err);
          }
        });
      }
    );
  });
{'fraction_non_alphanumeric': 0.1812219537452537, 'fraction_numerical': 0.011045909561615464, 'mean_word_length': 2.44589774078478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5964962', 'n_tokens_mistral': 934, 'n_tokens_neox': 905, 'n_words': 154}