<commit_before>const test = require('tape');
const fs = require('fs');
const path = require('path');
const load = require('load-json-file');
const write = require('write-json-file');
const mkdirp = require('mkdirp');
const featureCollection = require('@turf/helpers').featureCollection;
const truncate = require('@turf/truncate');
const lineSlice = require('./');

const directories = {
    in: path.join(__dirname, 'test', 'in') + path.sep,
    out: path.join(__dirname, 'test', 'out') + path.sep
};

const fixtures = fs.readdirSync(directories.in).map(folder => {
    return {
        folder,
        linestring: load.sync(path.join(directories.in, folder, 'linestring.geojson')),
        start: load.sync(path.join(directories.in, folder, 'start.geojson')),
        stop: load.sync(path.join(directories.in, folder, 'stop.geojson'))
    };
});

test('turf-line-slice', t => {
    for (const {folder, linestring, start, stop} of fixtures) {
        const output = path.join(directories.out, folder) + path.sep;

        const sliced = truncate(lineSlice(start, stop, linestring));
        sliced.properties['stroke'] = '#f0f';
        sliced.properties['stroke-width'] = 6;

        const results = featureCollection([linestring, start, stop, sliced]);
        if (process.env.REGEN) {
            mkdirp.sync(output);
            write.sync(output + 'sliced.geojson', sliced);
            write.sync(output + 'results.geojson', results);
        }
        const expected = load.sync(output + 'sliced.geojson');

        t.equal(sliced.geometry.coordinates.length, expected.geometry.coordinates.length, folder + ' - coordinates');
        t.deepEquals(sliced, expected, folder + ' - geojson');
    }
    t.end();
});<commit_msg>Remove equals turf-line-slice - deepEquals would catch the same errors as equals<commit_after>const test = require('tape');
const fs = require('fs');
const path = require('path');
const load = require('load-json-file');
const write = require('write-json-file');
const mkdirp = require('mkdirp');
const featureCollection = require('@turf/helpers').featureCollection;
const truncate = require('@turf/truncate');
const lineSlice = require('./');

const directories = {
    in: path.join(__dirname, 'test', 'in') + path.sep,
    out: path.join(__dirname, 'test', 'out') + path.sep
};

const fixtures = fs.readdirSync(directories.in).map(folder => {
    return {
        folder,
        linestring: load.sync(path.join(directories.in, folder, 'linestring.geojson')),
        start: load.sync(path.join(directories.in, folder, 'start.geojson')),
        stop: load.sync(path.join(directories.in, folder, 'stop.geojson'))
    };
});

test('turf-line-slice', t => {
    for (const {folder, linestring, start, stop} of fixtures) {
        const output = path.join(directories.out, folder) + path.sep;

        const sliced = truncate(lineSlice(start, stop, linestring));
        sliced.properties['stroke'] = '#f0f';
        sliced.properties['stroke-width'] = 6;

        const results = featureCollection([linestring, start, stop, sliced]);
        if (process.env.REGEN) {
            mkdirp.sync(output);
            write.sync(output + 'sliced.geojson', sliced);
            write.sync(output + 'results.geojson', results);
        }
        const expected = load.sync(output + 'sliced.geojson');

        t.deepEquals(sliced, expected, folder);
    }
    t.end();
});
{'fraction_non_alphanumeric': 0.16411314083677078, 'fraction_numerical': 0.0011785503830288745, 'mean_word_length': 3.44954128440367, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '7567081', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1045, 'n_words': 221}