<commit_before>import parallel from "../../src/browser/index";

describe("ParallelIntegration", function () {
     it("reduce waits for the result to be computed on the workers and returns the reduced value", function (done) {
         parallel
             .range(100)
             .reduce(0, (memo: number, value: number) => {
                 for (let i = 0; i < 1e7; ++i) {
                     // busy wait
                 }

                 return memo + value;
             })
             .then(result => {
                 expect(result).toBe(4950);
                 done();
             });
     }, 10000);

    it("maps an input array to an output array", function (done) {
        const data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

        parallel.collection(data)
            .map(value => value ** 2)
            .value()
            .then(result => {
                expect(result).toEqual([0, 1, 4, 9, 16, 25, 36, 49, 64, 81]);
                done();
            });
    });
});<commit_msg>Remove busy wait to avoid timeout on browserstack<commit_after>import parallel from "../../src/browser/index";

describe("ParallelIntegration", function () {
     it("reduce waits for the result to be computed on the workers and returns the reduced value", function (done) {
         parallel
             .range(100)
             .reduce(0, (memo: number, value: number) => memo + value)
             .then(result => {
                 expect(result).toBe(4950);
                 done();
             });
     }, 10000);

    it("maps an input array to an output array", function (done) {
        const data = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

        parallel.collection(data)
            .map(value => value ** 2)
            .value()
            .then(result => {
                expect(result).toEqual([0, 1, 4, 9, 16, 25, 36, 49, 64, 81]);
                done();
            });
    });
});
{'fraction_non_alphanumeric': 0.1457127827459232, 'fraction_numerical': 0.0436612309310889, 'mean_word_length': 1.5125495376486129, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6877293', 'n_tokens_mistral': 595, 'n_tokens_neox': 516, 'n_words': 169}