<commit_before>var expect = require('chai').expect;
var Websocket = require('ws');
var libPath = process.env.TEST_COV ? '../lib-cov/' : '../lib/';
var Helmet = require(libPath + 'helmet');
var Os = require('os')

describe('Helmet', function() {

    describe('#constructor', function() {

        it('cannot be constructed without new', function(done) {

            var fn = function() {

                var helmet = Helmet();
            };

            expect(fn).to.throw(Error);
            done();
        });

        it('can be constructed with new', function(done) {

            var fn = function() {

                var helmet = new Helmet({websocketPort: 3001});
            };

            expect(fn).to.not.throw(Error);
            done();
        });

        it('uses the helmet defaults when no config is passed in', function(done) {

            var helmet = new Helmet();

            expect(helmet.settings.host).to.equal('0.0.0.0');
            expect(helmet.settings.websocketPort).to.equal(3000);
            done();
        });

        it('uses the passed in config', function(done) {

            var helmet = new Helmet({host: 'localhost', websocketPort: 3002});

            expect(helmet.settings.host).to.equal('localhost');
            expect(helmet.settings.websocketPort).to.equal(3002);
            done();
        });

        it('adds message to subscribers list when receiving message', function(done) {

            var config = {host: 'localhost', websocketPort: 3010}
            var helmet = new Helmet(config);

            var ws = new Websocket("ws://" + config.host + ':' + config.websocketPort);
            ws.readyState = Websocket.OPEN;
            
            ws.on('open', function() {
<commit_msg>added comment to my test case<commit_after>var expect = require('chai').expect;
var Websocket = require('ws');
var libPath = process.env.TEST_COV ? '../lib-cov/' : '../lib/';
var Helmet = require(libPath + 'helmet');
var Os = require('os')

describe('Helmet', function() {

    describe('#constructor', function() {

        it('cannot be constructed without new', function(done) {

            var fn = function() {

                var helmet = Helmet();
            };

            expect(fn).to.throw(Error);
            done();
        });

        it('can be constructed with new', function(done) {

            var fn = function() {

                var helmet = new Helmet({websocketPort: 3001});
            };

            expect(fn).to.not.throw(Error);
            done();
        });

        it('uses the helmet defaults when no config is passed in', function(done) {

            var helmet = new Helmet();

            expect(helmet.settings.host).to.equal('0.0.0.0');
            expect(helmet.settings.websocketPort).to.equal(3000);
            done();
        });

        it('uses the passed in config', function(done) {

            var helmet = new Helmet({host: 'localhost', websocketPort: 3002});

            expect(helmet.settings.host).to.equal('localhost');
            expect(helmet.settings.websocketPort).to.equal(3002);
            done();
        });

        // Adds coverage. May need to add more to this later

        it('adds message to subscribers list when receiving message', function(done) {

            var config = {host: 'localhost', websocketPort: 3010}
            var helmet = new Helmet(config);

            var ws = new Websocket("ws://" + config.host + ':' + config.websocketPort);
            ws.readyState = Websocket.OPEN;
            
            ws.on('open', function() {

{'fraction_non_alphanumeric': 0.14481026785714285, 'fraction_numerical': 0.013392857142857142, 'mean_word_length': 1.9751037344398341, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6668118', 'n_tokens_mistral': 1050, 'n_tokens_neox': 958, 'n_words': 245}