<commit_before>'use strict';

var isPortBusy = require('../');

describe('isPortBusy', function () {

    it('should be defined', function () {
        expect(isPortBusy).toBeDefined();
    });

});<commit_msg>added unit test to check when port is busy<commit_after>'use strict';

var http = require('http');
var isPortBusy = require('../');
var server = null;
var port = 8888;

describe('isPortBusy', function () {

    beforeEach(function (done) {
        server = http.createServer();
        server.listen(port, done);
    });

    it('should be defined', function () {

        expect(isPortBusy).toBeDefined();
    });

    it('should execute .then when port is busy', function (done) {

        isPortBusy(port).then(done);
    });

    afterEach(function (done) {
        server.close(done);
    });
});
{'fraction_non_alphanumeric': 0.16892725030826142, 'fraction_numerical': 0.004932182490752158, 'mean_word_length': 3.142857142857143, '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': '2937972', 'n_tokens_mistral': 258, 'n_tokens_neox': 245, 'n_words': 60}