<commit_before>// assertion library
// /////////////////////////////////////////////////////////
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);

// modules to test
// /////////////////////////////////////////////////////////
var Rawr = require('../../index');
var rawr;

describe('promptosaurus', function () {
    'use strict';

    beforeEach(function () {
        rawr = new Rawr();
    });

    afterEach(function () {
        rawr.line.close();
        rawr = null;
    });

    describe('#add()', function () {

        var fakeString = 'foo';
        var fakeFunc = function () {};

        it('should update internal queue using passed arguments', function () {
            rawr.add(fakeString, fakeFunc);
            rawr.queue[0].query.should.contain(fakeString);
            rawr.queue[0].callback.should.equal(fakeFunc);
        });

        it('should return promptosaurus instance', function () {
            var returnValue = rawr.add(fakeString, fakeFunc);
            returnValue.should.equal(rawr);
        });<commit_msg>added unit test fro #add() function<commit_after>// assertion library
// /////////////////////////////////////////////////////////
var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
chai.should();
chai.use(sinonChai);

// modules to test
// /////////////////////////////////////////////////////////
var Rawr = require('../../index');
var rawr;

describe('promptosaurus', function () {
    'use strict';

    beforeEach(function () {
        rawr = new Rawr();
    });

    afterEach(function () {
        rawr.line.close();
        rawr = null;
    });

    describe('#add()', function () {

        var fakeString = 'foo';
        var fakeFunc = function () {};

        it('should update internal queue using passed arguments', function () {
            rawr.add(fakeString, fakeFunc);
            rawr.queue[0].query.should.contain(fakeString);
            rawr.queue[0].callback.should.equal(fakeFunc);
        });

        it('should return promptosaurus instance', function () {
            var returnValue = rawr.add(fakeString, fakeFunc);
            returnValue.should.equal(rawr);
        });

        describe('when no callback is passed', function () {

            it('should push empty function to queue', function () {
                rawr.add(fakeString);
                rawr.queue[0].query.should.contain(fakeString);
                rawr.queue[0].callback.should.be.a('function');
            });
        });
{'fraction_non_alphanumeric': 0.229318968834167, 'fraction_numerical': 0.002308580223162755, 'mean_word_length': 1.7777777777777777, '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': '7464104', 'n_tokens_mistral': 704, 'n_tokens_neox': 680, 'n_words': 149}