<commit_before>/**
 * Created by Maurice on 6/17/2015.
 */

'use strict';

var gulp = require('gulp');
var mainBowerFiles = require('../index');
var streamAssert = require('stream-assert');
var assert = require("assert");

describe('gulp-main-bower-files', function () {
    it('is a function', function () {
        assert.equal(typeof mainBowerFiles, 'function');
    });

    describe('without a bowerrc file', function () {
        describe('without a bower file', function () {
            it('does not fail', function (done) {
                gulp.src(__dirname + '/no-bowerrc/not-there.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(0))
                    .pipe(streamAssert.end(done));
            });
        });

        describe('with a bower file', function () {

            it('can process a single dependency', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(1))
                    .pipe(streamAssert.end(done));
            });

            it('can process multiple dependencies', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(3))
                    .pipe(streamAssert.end(done));
            });

            it('can process multiple dependencies with includeSelf', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles({includeSelf: true}))
                    .pipe(streamAssert.length(4))
                    .pipe(streamAssert.end(done));
            });

            it('can override main files with filter', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles('**/*.*', {
                        overrides: {
                            multi: {
                                main: ['*.js', '*.css']
                            }
                        }
                    }))
                    .pipe(streamAssert.length(4))
                    .pipe(streamAssert.end(done));
            });

            it('can override main files without filter', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')<commit_msg>Added tests for different parameter combinations<commit_after>/**
 * Created by Maurice on 6/17/2015.
 */

'use strict';

var gulp = require('gulp');
var mainBowerFiles = require('../index');
var streamAssert = require('stream-assert');
var assert = require("assert");

describe('gulp-main-bower-files', function () {
    it('is a function', function () {
        assert.equal(typeof mainBowerFiles, 'function');
    });

    describe('without a bowerrc file', function () {
        describe('without a bower file', function () {
            it('does not fail', function (done) {
                gulp.src(__dirname + '/no-bowerrc/not-there.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(0))
                    .pipe(streamAssert.end(done));
            });
        });

        describe('with a bower file', function () {

            it('can process a single dependency', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(1))
                    .pipe(streamAssert.end(done));
            });

            it('can process multiple dependencies', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles())
                    .pipe(streamAssert.length(3))
                    .pipe(streamAssert.end(done));
            });

            it('can process multiple dependencies via a callback function', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles(function (err, files) {
                        assert.equal(err, null);
                        assert.equal(files.length, 3);
                    }))
                    .pipe(streamAssert.length(3))
                    .pipe(streamAssert.end(done));
            });

            it('can process multiple dependencies with includeSelf', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles({includeSelf: true}))
                    .pipe(streamAssert.length(4))
                    .pipe(streamAssert.end(done));
            });

            it('can override main files with filter with a callback', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles('**/*.*', function (err, files) {
                        assert.equal(err, null);
                        assert.equal(files.length, 3);
                    }))
                    .pipe(streamAssert.length(3))
                    .pipe(streamAssert.end(done));
            });

            it('can override main files with filter', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles('**/*.*', {
                        overrides: {
                            multi: {
                                main: ['*.js', '*.css']
                            }
                        }
                    }))
                    .pipe(streamAssert.length(4))
                    .pipe(streamAssert.end(done));
            });

            it('can load main files with callback function', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
                    .pipe(mainBowerFiles({
                        overrides: {
                            multi: {
                                main: ['*.js', '*.css']
                            }
                        }
                    }, function(err, files){
                        assert.equal(err, null);
                        assert.equal(files.length, 4);
                    }))
                    .pipe(streamAssert.length(4))
                    .pipe(streamAssert.end(done));
            });

            it('can override main files without filter', function (done) {
                gulp.src(__dirname + '/no-bowerrc/bower-simple-multi.json')
{'fraction_non_alphanumeric': 0.1336154776299879, 'fraction_numerical': 0.004534461910519952, 'mean_word_length': 1.3905346820809248, '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': '192001', 'n_tokens_mistral': 1744, 'n_tokens_neox': 1634, 'n_words': 311}