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


describe('Penalties', function () {
    var penalties = new Penalties({
        teamA: common.teamEngland,
        teamB: common.teamSlovakia
    });

    penalties.simulate();

    describe('#simulate()', function () {
        context('#hasFinished', function () {
            it('should return true', function () {
                assert.equal(penalties.hasFinished(), true);
            });
        });

        context('#finishTime', function () {
            it('should set the time to the final goal time', function () {
                var goals = [];
                var finishTime = penalties.finishTime.getTime();

                penalties.goalManager.forEach(function (goal) {
                    goals.push(goal);
                });

                goals.sort(function (a, b) {
                    return b.time.getTime() - a.time.getTime();
                });

                assert.equal(finishTime, goals[0].time.getTime());
            });
        });

        context('goals', function () {
            it('should set the start times of each of the goals', function () {
                penalties.goalManager.forEach(function (goal) {
                    assert.instanceOf(goal.time, Date);
                });
            });
<commit_msg>Adds test to verify that Penalties are seeded<commit_after>var assert = require('chai').assert;
var Penalties = require('../src/Penalties');
var common = require('./common');


describe('Penalties', function () {
    var penalties = new Penalties({
        teamA: common.teamEngland,
        teamB: common.teamSlovakia,
        seed: 'test'
    });

    describe('#simulate()', function () {
        penalties.simulate();

        it('should have the correct score', function () {
            var score = penalties.goalManager.getScore();

            assert.deepEqual(score, [3, 4]);
        });

        context('#hasFinished', function () {
            it('should return true', function () {
                assert.equal(penalties.hasFinished(), true);
            });
        });

        context('#finishTime', function () {
            it('should set the time to the final goal time', function () {
                var goals = [];
                var finishTime = penalties.finishTime.getTime();

                penalties.goalManager.forEach(function (goal) {
                    goals.push(goal);
                });

                goals.sort(function (a, b) {
                    return b.time.getTime() - a.time.getTime();
                });

                assert.equal(finishTime, goals[0].time.getTime());
            });
        });

        context('goals', function () {
            it('should set the start times of each of the goals', function () {
                penalties.goalManager.forEach(function (goal) {
                    assert.instanceOf(goal.time, Date);
                });
            });

{'fraction_non_alphanumeric': 0.13836477987421383, 'fraction_numerical': 0.0013240648791790798, 'mean_word_length': 1.72007200720072, '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': '2189650', 'n_tokens_mistral': 807, 'n_tokens_neox': 740, 'n_words': 171}