<commit_before>'use strict';

var assert = require('assert-plus');
var flash  = require('../lib/flash');

describe('Request tests ::', function () {

  var request  = {session: {}};
  var response = {locals: {}};

  before(function (done) {
    return flash(request, response, done);
  });

  describe("addFlash(type, message)", function () {
    it('is callable ', function () {
      assert.func(request.addFlash);
      assert.ok(request.addFlash(
        'success',
        'Is callable and and stores a message.'
      ))
    });

    it('stores a message', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.object(session, 'Is an object');
      assert.array(session.success);
      assert.strictEqual(
        session.success[0],
        'Is callable and and stores a message.'
      );
    });

    it('stores more than one message per type', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.object(session, 'Is an object');
      assert.array(session.success);
      assert.strictEqual(
        session.success[0],
        'Is callable and and stores a message.'
      );
    });
  });

});<commit_msg>Update the request unit tests<commit_after>'use strict';

var assert = require('assert-plus');
var flash  = require('../lib/flash');

describe('Request tests ::', function () {

  var request  = {session: {}};
  var response = {locals: {}};

  before(function (done) {
    return flash(request, response, done);
  });

  describe('addFlash(type, message)', function () {
    it('is callable ', function () {
      assert.func(
        request.addFlash,
        'addFlash must be a function'
      );
      assert.ok(request.addFlash('success', 'Stores a message.'));
      assert.ok(request.addFlash('success', 'Stores another message.'));
    });

    it('stores a message', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.object(
        session,
        'The session must be an object'
      );
      assert.array(
        session.success,
        'The flash message type must have an array of messages'
      );
      assert.strictEqual(
        session.success[0],
        'Stores a message.'
      );
    });

    it('stores more than one message per type', function () {
      var session = request.session[Object.keys(request.session)[0]];
      assert.strictEqual(
        session.success.length,
        2,
        'The flash message type must have an array of messages'
      );
    });
  });

  describe('getFlash(type)', function () {
    it('is callable', function () {
      assert.func(
        request.getFlash,
        'getFlash must be a function'
      );
    });
  });

  describe('hasFlash(type)', function () {
    it('is callable', function () {
      assert.func(
        request.hasFlash,
        'hasFlash must be a function'
      );
    });
  });

});
{'fraction_non_alphanumeric': 0.151618398637138, 'fraction_numerical': 0.00272572402044293, 'mean_word_length': 2.5458937198067635, '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': '5582935', 'n_tokens_mistral': 874, 'n_tokens_neox': 839, 'n_words': 213}