<commit_before>var util = require('util');
var assert = require('assert');

module.exports = function () {
    this.ShouldGetAResponse = () => {
        assert.equal(this.response.statusCode, 200);
        assert.ok(this.response.body);
        assert.ok(this.response.body.length);
    };

    this.ShouldBeValidJSON = (callback) => {
        try {
            this.json = JSON.parse(this.response.body);
            callback();
        } catch (e) {
            callback(e);
        }
    };

    this.ShouldBeWellFormed = () => {
        assert.equal(typeof this.json.status, 'number');
    };

    this.WhenIRouteIShouldGet = (table, callback) => {
        this.reprocessAndLoadData(() => {
            var headers = new Set(table.raw()[0]);

            var requestRow = (row, ri, cb) => {
                var got;

                var afterRequest = (err, res, body) => {
                    if (err) return cb(err);
                    if (body && body.length) {
                        var instructions, bearings, turns, modes, times, distances;

                        var json = JSON.parse(body);

                        var hasRoute = json.code === 'ok';
                        //console.log(json.routes[0].legs[0].steps);

                        if (hasRoute) {
                            instructions = this.wayList(json.routes[0]);
                            bearings = this.bearingList(json.routes[0]);
                            turns = this.turnList(json.routes[0]);
                            modes = this.modeList(json.routes[0]);
                            times = this.timeList(json.routes[0]);
                            distances = this.distanceList(json.routes[0]);
                        }

                        if (headers.has('status')) {
                            got.status = json.status.toString();
                        }

                        if (headers.has('message')) {
                            got.message = json.status_message;
                        }

                        if (headers.has('#')) {
                            // comment column<commit_msg>rm console.log my bad<commit_after>var util = require('util');
var assert = require('assert');

module.exports = function () {
    this.ShouldGetAResponse = () => {
        assert.equal(this.response.statusCode, 200);
        assert.ok(this.response.body);
        assert.ok(this.response.body.length);
    };

    this.ShouldBeValidJSON = (callback) => {
        try {
            this.json = JSON.parse(this.response.body);
            callback();
        } catch (e) {
            callback(e);
        }
    };

    this.ShouldBeWellFormed = () => {
        assert.equal(typeof this.json.status, 'number');
    };

    this.WhenIRouteIShouldGet = (table, callback) => {
        this.reprocessAndLoadData(() => {
            var headers = new Set(table.raw()[0]);

            var requestRow = (row, ri, cb) => {
                var got;

                var afterRequest = (err, res, body) => {
                    if (err) return cb(err);
                    if (body && body.length) {
                        var instructions, bearings, turns, modes, times, distances;

                        var json = JSON.parse(body);

                        var hasRoute = json.code === 'ok';

                        if (hasRoute) {
                            instructions = this.wayList(json.routes[0]);
                            bearings = this.bearingList(json.routes[0]);
                            turns = this.turnList(json.routes[0]);
                            modes = this.modeList(json.routes[0]);
                            times = this.timeList(json.routes[0]);
                            distances = this.distanceList(json.routes[0]);
                        }

                        if (headers.has('status')) {
                            got.status = json.status.toString();
                        }

                        if (headers.has('message')) {
                            got.message = json.status_message;
                        }

                        if (headers.has('#')) {
                            // comment column
{'fraction_non_alphanumeric': 0.12724228653432193, 'fraction_numerical': 0.0052618990672088015, 'mean_word_length': 1.215042372881356, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '5264356', 'n_tokens_mistral': 1083, 'n_tokens_neox': 1040, 'n_words': 189}