<commit_before>var assert = require('chai').assert;
var Match = require('../src/Match');
var MatchOutputter = require('../src/MatchOutputter');
var common = require('./common');


describe('Match', function () {
    var match = new Match(common.matchParams);

    describe('#simulate()', function () {
        it('should return the same score as #score property', function () {
            assert.equal(match.simulate(), match.score);
        });
    });

    describe('#startTime', function () {
        var startTime = common.matchParams.startTime;

        it('should set the first half start time', function () {
            var firstHalfStartTime = match.firstHalf.startTime;
            
            assert.equal(firstHalfStartTime.getTime(), startTime.getTime());
        });

        it('should always set startTime as instance of Date', function () {
            delete common.matchParams.startTime;

            var match = new Match(common.matchParams);

            assert.instanceOf(match.startTime, Date);
        });
    });
});<commit_msg>Adds tests to test for when the halfs begin and end<commit_after>var assert = require('chai').assert;
var Match = require('../src/Match');
var MatchOutputter = require('../src/MatchOutputter');
var common = require('./common');


describe('Match', function () {
    var match = new Match(common.matchParams);

    describe('#simulate()', function () {
        var result = match.simulate();
        var startTime = match.startTime.getTime();

        it('should return the same score as #score property', function () {
            assert.equal(result, match.score);
        });

        context('creating the first half', function () {
            it('should set its #startTime correctly', function () {
                assert.equal(match.firstHalf.startTime.getTime(), startTime);
            });

            it('should have a length of 45 minutes', function () {
                assert.equal(match.firstHalf.length, 45 * 60000);
            });
        });

        context('creating the second half', function () {
            it('should start 1 hour after the match started', function () {
                var expectedStartTime = startTime + (60 * 60000);
                var secondHalfStartTime = match.secondHalf.startTime.getTime();

                assert.equal(secondHalfStartTime, expectedStartTime);
            });

            it('should have a length of 45 minutes', function () {
                assert.equal(match.secondHalf.length, 45 * 60000);
            });
        });

        context('creating the first half of extra time', function () {
            it('should start 5 minutes after second half ended', function () {
                var secondHalfFinish = match.secondHalf.finishTime;
                var secondHalfFinishTime = secondHalfFinish.getTime();
                var expectedStartTime = secondHalfFinishTime + (5 * 60000);
                var thisStart = match.extraTimeFirstHalf.startTime;
                var thisStartTime = thisStart.getTime();

                assert.equal(thisStartTime, expectedStartTime);
            });

            it('should have a length of 15 minutes', function () {
                assert.equal(match.extraTimeFirstHalf.length, 15 * 60000);
            });
        });

        context('creating the second half of extra time', function () {
            it('should start 5 minutes after first half of ET', function () {
                var firstHalfETFinish = match.extraTimeFirstHalf.finishTime;
                var firstHalfETFinishTime = firstHalfETFinish.getTime();
                var secondHalfETStart = match.extraTimeSecondHalf.startTime;
                var secondHalfETStartTime = secondHalfETStart.getTime();
                var expectedStartTime = firstHalfETFinishTime + (5 * 60000);

                assert.equal(secondHalfETStartTime, expectedStartTime);
            });

            it('should have a length of 15 minutes', function () {
                var expectedLength = 15 * 60000;

                assert.equal(match.extraTimeSecondHalf.length, expectedLength);
            });
        });
    });

    describe('#startTime', function () {
        var startTime = common.matchParams.startTime;

        it('should set the first half start time', function () {
            var firstHalfStartTime = match.firstHalf.startTime;
            
            assert.equal(firstHalfStartTime.getTime(), startTime.getTime());
        });

        it('should always set startTime as instance of Date', function () {
            delete common.matchParams.startTime;

            var match = new Match(common.matchParams);

            assert.instanceOf(match.startTime, Date);
        });
    });
});
{'fraction_non_alphanumeric': 0.11611675126903553, 'fraction_numerical': 0.012267343485617596, 'mean_word_length': 2.2257844474761255, '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': '3173956', 'n_tokens_mistral': 1271, 'n_tokens_neox': 1134, 'n_words': 305}