<commit_before>// example unit tests

//Small and simple testing module
var test = require('tape');
//Improves tape with a nice terminal output
var tapSpec = require('tap-spec');
test.createStream()
  .pipe(tapSpec())
  .pipe(process.stdout);

var handlers = require('../controllers/handler.js');

//static stuff
var static__ = {};
var reply = function(a) {
  //console.log(a);
  static__ = a;
};


test('Save a new slide', function (t) {
  var dummySlide = {};

  t.doesNotThrow(function () {
    handlers.newSlide({payload: dummySlide}, reply);
  });

  t.equal(0, static__.id, "correct id");
  t.end();
});

test('Get not existing slide', function (t) {
  t.doesNotThrow(function () {
    handlers.getSlide({params: {id: 1}}, reply);
  });

  t.notEqual(1, static__.id, "id is not existing");
  t.equal(404, static__.output.statusCode, "status");
  t.end();
});

test('Create and get slide', function (t) {
  var dummySlide = {};

  t.doesNotThrow(function () {
    handlers.newSlide({payload: dummySlide}, reply);
  });
  t.equal(1, static__.id, "correct new id");

  t.doesNotThrow(function () {
    handlers.getSlide({params: {id: 0}}, reply);
  });
  t.equal(1, static__.id, "correct id of getted slide");
  t.equal(undefined, static__.output, "empty attributes");
  t.end();
});

test('Update new slide', function (t) {
  //get old one
  t.doesNotThrow(function () {
    handlers.newSlide({payload: {id: 2}}, reply);
  }, "get old one without failure");
  t.equal(2, static__.id, "correct new id");<commit_msg>Reverted last commit<commit_after>// example unit tests

//Small and simple testing module
var test = require('tape');
//Improves tape with a nice terminal output
var tapSpec = require('tap-spec');
test.createStream()
  .pipe(tapSpec())
  .pipe(process.stdout);

var handlers = require('../controllers/handler.js');

//static stuff
var static__ = {};
var reply = function(a) {
  //console.log(a);
  static__ = a;
};


test('Save a new slide', function (t) {
  var dummySlide = {};

  t.doesNotThrow(function () {
    handlers.newSlide({payload: dummySlide}, reply);
  });

  t.equal(0, static__.id, "correct id");
  t.end();
});

test('Get not existing slide', function (t) {
  t.doesNotThrow(function () {
    handlers.getSlide({params: {id: 1}}, reply);
  });

  t.notEqual(1, static__.id, "id is not existing");
  t.equal(404, static__.output.statusCode, "status");
  t.end();
});

test('Create and get slide', function (t) {
  var dummySlide = {};

  t.doesNotThrow(function () {
    handlers.newSlide({payload: dummySlide}, reply);
  });
  t.equal(1, static__.id, "correct new id");

  t.doesNotThrow(function () {
    handlers.getSlide({params: {id: 0}}, reply);
  });
  t.equal(0, static__.id, "correct id of getted slide");
  t.equal(undefined, static__.output, "empty attributes");
  t.end();
});

test('Update new slide', function (t) {
  //get old one
  t.doesNotThrow(function () {
    handlers.newSlide({payload: {id: 2}}, reply);
  }, "get old one without failure");
  t.equal(2, static__.id, "correct new id");
{'fraction_non_alphanumeric': 0.18468616496878082, 'fraction_numerical': 0.007229707525468288, 'mean_word_length': 3.965742251223491, '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': '2194762', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1036, 'n_words': 267}