<commit_before>'use strict';

/* global describe, it, beforeEach */

require('should'); // extends Object with `should`
var Spy = require('mojo-spy');

var FooBar = require('../src/js/foobars.js');

function nullfunc() {}

global.Element = function() {};
global.Element.prototype = {
    classList: {
        add: nullfunc
    },
    appendChild: nullfunc
};
global.document = {
    createElement: function() {
        return new Element();
    },
    getElementById: function() {
        return null;
    }
};

describe('require() returns an object that', function() {
    it('is a function that', function() {
        (typeof FooBar).should.equal('function');
    });
    describe('when used as a constructor, returns an API that', function() {
        var spy, foobar;
        beforeEach(function() {
            foobar = new FooBar(33, 55);
        });
        it('is a Foobar', function() {
            (foobar instanceof FooBar).should.be.true();
        });
        it('has a member `min` === 1st constructor param', function() {
            foobar.min.should.equal(33);
        });
        it('has a member `max` === 2nd constructor param', function() {
            foobar.max.should.equal(55);
        });
        it('has a member `bar` of type Element', function() {
            (foobar.bar instanceof Element).should.be.true();
        });
        it('has a member `thumb` of type Element', function() {
            (foobar.thumb instanceof Element).should.be.true();
        });
        describe('has a member `set`', function() {
            it('is a function that', function() {
                (typeof foobar.set).should.equal('function');
            });
        });
        describe('has a member `get`', function() {
            it('is a function that', function() {
                (typeof foobar.get).should.equal('function');
            });
        });
        describe('has a member `resize`', function() {
            it('is a function that', function() {
                (typeof foobar.resize).should.equal('function');
            });
        });
        describe('has a member `close`', function() {
            it('is a function that', function() {
                (typeof foobar.close).should.equal('function');
            });
        });
    });
});<commit_msg>Unit test for `index` setter/getter<commit_after>'use strict';

/* global describe, it, beforeEach */

require('should'); // extends Object with `should`
var Spy = require('mojo-spy');

var FooBar = require('../src/js/foobars.js');

function nullfunc() {}

global.Element = function() {};
global.Element.prototype = {
    classList: {
        add: nullfunc
    },
    appendChild: nullfunc,
    style: {}
};
global.document = {
    createElement: function() {
        return new Element();
    },
    getElementById: function() {
        return null;
    }
};

describe('require() returns an object that', function() {
    it('is a function that', function() {
        (typeof FooBar).should.equal('function');
    });
    describe('when used as a constructor, returns an API that', function() {
        var spy, foobar;
        beforeEach(function() {
            foobar = new FooBar(33, 55);
        });
        it('is a Foobar', function() {
            (foobar instanceof FooBar).should.be.true();
        });
        it('has a member `min` === 1st constructor param', function() {
            foobar.min.should.equal(33);
        });
        it('has a member `max` === 2nd constructor param', function() {
            foobar.max.should.equal(55);
        });
        it('has a member `bar` of type Element', function() {
            (foobar.bar instanceof Element).should.be.true();
        });
        it('has a member `thumb` of type Element', function() {
            (foobar.thumb instanceof Element).should.be.true();
        });
        describe('has a member `index`', function() {
            it('is a getter', function() {
                (typeof Object.getOwnPropertyDescriptor(FooBar.prototype, 'index').get).should.equal('function');
            });
        });
        describe('has a member `index`', function() {
            it('is a setter', function() {
                (typeof Object.getOwnPropertyDescriptor(FooBar.prototype , 'index').set).should.equal('function');
            });
        });
        describe('has a member `resize`', function() {
            it('is a function', function() {
                (typeof foobar.resize).should.equal('function');
            });
        });
        describe('has a member `close`', function() {
            it('is a function', function() {
                (typeof foobar.close).should.equal('function');
            });
        });
    });
});
{'fraction_non_alphanumeric': 0.16128346791330217, 'fraction_numerical': 0.004249893752656183, 'mean_word_length': 2.1192842942345926, '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': '2793846', 'n_tokens_mistral': 1321, 'n_tokens_neox': 1256, 'n_words': 329}