<commit_before>"use strict";

var path   = require("path"),
    assert = require("assert"),
    
    Promise    = require("../src/lib/promise"),
    sequential = require("../src/lib/sequential");

describe("/lib", function() {
    describe("/sequential.js", function() {
        it("should run a series of promises in order", function() {
            var out = [];
            
            return sequential([
                function() {
                    return (new Promise(function(resolve) {
                        out.push(1);
                        return resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve) {
                        out.push(2);
                        return resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve) {
                        out.push(3);
                        return resolve();
                    }));
                }
            ])
            .then(function() {
                assert.deepEqual(out, [ 1, 2, 3 ]);
            });
        });
        
        it("should stop execution if a promise rejects", function() {
            return sequential([
                function() {
                    return (new Promise(function(resolve) {
                        resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve, reject) {
                        reject("rejected");
                    }));
                },
                function() {
                    return (new Promise(function(resolve) {
                        assert.fail();
                    }));
                }
            ])
            .then(
                function() {
                    assert.fail();
                },
                function(error) {
                    assert.equal("rejected", error);
                }
            );
        });
    });
});<commit_msg>Silence ESLint warnings<commit_after>"use strict";

var assert = require("assert"),
    
    Promise    = require("../src/lib/promise"),
    sequential = require("../src/lib/sequential");

describe("/lib", function() {
    describe("/sequential.js", function() {
        it("should run a series of promises in order", function() {
            var out = [];
            
            return sequential([
                function() {
                    return (new Promise(function(resolve) {
                        out.push(1);
                        return resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve) {
                        out.push(2);
                        return resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve) {
                        out.push(3);
                        return resolve();
                    }));
                }
            ])
            .then(function() {
                assert.deepEqual(out, [ 1, 2, 3 ]);
            });
        });
        
        it("should stop execution if a promise rejects", function() {
            return sequential([
                function() {
                    return (new Promise(function(resolve) {
                        resolve();
                    }));
                },
                function() {
                    return (new Promise(function(resolve, reject) {
                        reject("rejected");
                    }));
                },
                function() {
                    return (new Promise(function() {
                        assert.fail();
                    }));
                }
            ])
            .then(
                function() {
                    assert.fail();
                },
                function(error) {
                    assert.equal("rejected", error);
                }
            );
        });
    });
});
{'fraction_non_alphanumeric': 0.12061031726810366, 'fraction_numerical': 0.00290627270525551, 'mean_word_length': 0.852017937219731, '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': '2823415', 'n_tokens_mistral': 923, 'n_tokens_neox': 840, 'n_words': 172}