<commit_before>var chai = require('chai');
var expect = chai.expect;

var TripCountCalculator = require('./../src/trip-count-calculator');

var trips = [{
    "date": new Date("2017-02-01T23:00:00.000Z"),
    "trips": [{
        "name": "J",
        "driver": "T",
        "passangers": [{
            "name": "P",
            "divider": 2
        }, {
            "name": "R",
            "divider": 2
        }]
    }]
}, {
    "date": new Date("2017-02-02T23:00:00.000Z"),
    "trips": [{
        "name": "JwA",
        "driver": "T",
        "passangers": [{
            "name": "R",
            "divider": 1
        }]
    }]
}, {
    "date": new Date("2017-02-03T23:00:00.000Z"),
    "trips": [{
        "name": "CZ",
        "driver": "T",
        "passangers": [{
            "name": "R",
            "divider": 1
        }]
    }]
}, {
    "date": new Date("2017-02-04T23:00:00.000Z"),
    "trips": [{
        "name": "JwCZ",
        "driver": "T",
        "passangers": [{
            "name": "R",
            "divider": 1
        }]
    }]
}, {
    "date": new Date("2017-02-05T23:00:00.000Z"),
    "trips": [{
        "name": "J",
        "driver": "P",
        "passangers": [{
            "name": "R",
            "divider": 1
        }, {
            "name": "T",
            "divider": 1
        }]
    }]
}];

var tripId = "J";

var expectedResult = [{
    "driver": "P",
    "counts": [{
        "passanger": "R",
        "count": "?"
    }, {
        "passanger": "T",
        "count": "?"
    }]
}, {
    "driver": "R",
    "counts": [{
        "passanger": "P",
        "count": "?"
    }, {
        "passanger": "T",
        "count": "?"
    }]
}, {
    "driver": "T",
    "counts": [{
        "passanger": "P",
        "count": "?"
    }, {
        "passanger": "R",
        "count": "?"
    }]
}];

describe('TripCountCalculator', function () {
    it('Should return correct number of drivers', function () {
        // Given
        var tripCountCalculator = new TripCountCalculator();

        // When
        var result = tripCountCalculator.calculate(trips, tripId);

        // Then
        expect(result.length).to.equal(expectedResult.length);
    })

    it('Should return correct drivers ids', function () {
        // Given
        var tripCountCalculator = new TripCountCalculator();

        // When
        var result = tripCountCalculator.calculate(trips, tripId);

        // Then
        var expectedDriverIds = expectedResult.map(function(value) {
            return value.driver;
        })

        var driversIds = result.map(function(value) {
            return value.driver;<commit_msg>Fix 'Given' in trip count calculator<commit_after>var chai = require('chai');
var expect = chai.expect;

var TripCountCalculator = require('./../src/trip-count-calculator');

var trips = [{
    date: new Date('2017-02-01T23:00:00.000Z'),
    trips: [{
        name: 'J',
        driver: 'P',
        passangers: [{
            name: 'R',
            divider: 1
        }, {
            name: 'T',
            divider: 1
        }]
    }]
}, {
    date: new Date('2017-02-02T23:00:00.000Z'),
    trips: [{
        name: 'J',
        driver: 'R',
        passangers: [{
            name: 'P',
            divider: 1
        }, {
            name: 'T',
            divider: 1
        }]
    }, {
        name: 'J',
        driver: 'R',
        passangers: [{
            name: 'P',
            divider: 1
        }, {
            name: 'T',
            divider: 1
        }]
    }]
}, {
    date: new Date('2017-02-03T23:00:00.000Z'),
    trips: [{
        name: 'J',
        driver: 'T',
        passangers: [{
            name: 'P',
            divider: 1
        }, {
            name: 'R',
            divider: 1
        }]
    }, {
        name: 'J',
        driver: 'T',
        passangers: [{
            name: 'P',
            divider: 1
        }, {
            name: 'R',
            divider: 1
        }]
    }, {
        name: 'J',
        driver: 'T',
        passangers: [{
            name: 'P',
            divider: 1
        }, {
            name: 'R',
            divider: 1
        }]
    }]
}];

var tripId = 'J';

var expectedResult = [{
    driver: 'P',
    counts: [{
        passanger: 'R',
        count: 1
    }, {
        passanger: 'T',
        count: 1
    }]
}, {
    driver: 'R',
    counts: [{
        passanger: 'P',
        count: 2
    }, {
        passanger: 'T',
        count: 2
    }]
}, {
    driver: 'T',
    counts: [{
        passanger: 'P',
        count: 3
    }, {
        passanger: 'R',
        count: '3'
    }]
}];

describe('TripCountCalculator', function () {
    it('Should return correct number of drivers', function () {
        // Given
        var tripCountCalculator = new TripCountCalculator();

        // When
        var result = tripCountCalculator.calculate(trips, tripId);

        // Then
        expect(result.length).to.equal(expectedResult.length);
    })

    it('Should return correct drivers ids', function () {
        // Given
        var tripCountCalculator = new TripCountCalculator();

        // When
        var result = tripCountCalculator.calculate(trips, tripId);

        // Then
        var expectedDriverIds = expectedResult.map(function(value) {
            return value.driver;
        })

        var driversIds = result.map(function(value) {
            return value.driver;
{'fraction_non_alphanumeric': 0.17525964391691395, 'fraction_numerical': 0.029859050445103858, 'mean_word_length': 1.4502498864152658, 'pattern_counts': {'":': 57, '<': 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': '1768559', 'n_tokens_mistral': 1888, 'n_tokens_neox': 1721, 'n_words': 355}