<commit_before>var buster = require("buster");
var assert = buster.assert;
var refute = buster.refute;
var busterConfiguration = require("../lib/buster-configuration");

buster.testCase("buster-configuration", {
    setUp: function () {
        this.c = busterConfiguration.create();
        this.rootPath = __dirname;
    },

    "should add groups": function () {
        this.c.addGroup("My group", {}, this.rootPath);

        assert.equals(this.c.groups.length, 1);
        var group = this.c.groups[0];
        assert.equals(group.name, "My group");
    },

    "should load groups from config file": function () {
        assert.isTrue(this.c.loadGroupsFromConfigFile(__dirname + "/buster"));
        assert.equals(this.c.groups.length, 1);
    },

    "should handle none existing file": function () {
        assert.isFalse(this.c.loadGroupsFromConfigFile(__dirname + "/does-not-exist"));
        assert.equals(this.c.groups.length, 0);
    },

    "should filter groups on environment": function () {
        this.c.addGroup("My group 1", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 2", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 3", {environment: "browser"}, this.rootPath);

        this.c.filterEnv("node");
        assert.equals(this.c.groups.length, 2);
    },

    "should handle non-string for env filtering": function () {
        this.c.addGroup("My group 1", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 2", {environment: "browser"}, this.rootPath);

        this.c.filterEnv(null);
        this.c.filterEnv({});
        this.c.filterEnv(1234);
        this.c.filterEnv([]);
        assert.equals(this.c.groups.length, 2);
    },

    "should filter groups on name": function () {
        this.c.addGroup("The test", {}, this.rootPath);
        this.c.addGroup("test the foo", {}, this.rootPath);
        this.c.addGroup("foo the bar", {}, this.rootPath);

        this.c.filterGroup(/test/);<commit_msg>New buster-assertions doesn't have isTrue/isFalse<commit_after>var buster = require("buster");
var assert = buster.assert;
var refute = buster.refute;
var busterConfiguration = require("../lib/buster-configuration");

buster.testCase("buster-configuration", {
    setUp: function () {
        this.c = busterConfiguration.create();
        this.rootPath = __dirname;
    },

    "should add groups": function () {
        this.c.addGroup("My group", {}, this.rootPath);

        assert.equals(this.c.groups.length, 1);
        var group = this.c.groups[0];
        assert.equals(group.name, "My group");
    },

    "should load groups from config file": function () {
        assert(this.c.loadGroupsFromConfigFile(__dirname + "/buster"));
        assert.equals(this.c.groups.length, 1);
    },

    "should handle none existing file": function () {
        refute(this.c.loadGroupsFromConfigFile(__dirname + "/does-not-exist"));
        assert.equals(this.c.groups.length, 0);
    },

    "should filter groups on environment": function () {
        this.c.addGroup("My group 1", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 2", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 3", {environment: "browser"}, this.rootPath);

        this.c.filterEnv("node");
        assert.equals(this.c.groups.length, 2);
    },

    "should handle non-string for env filtering": function () {
        this.c.addGroup("My group 1", {environment: "node"}, this.rootPath);
        this.c.addGroup("My group 2", {environment: "browser"}, this.rootPath);

        this.c.filterEnv(null);
        this.c.filterEnv({});
        this.c.filterEnv(1234);
        this.c.filterEnv([]);
        assert.equals(this.c.groups.length, 2);
    },

    "should filter groups on name": function () {
        this.c.addGroup("The test", {}, this.rootPath);
        this.c.addGroup("test the foo", {}, this.rootPath);
        this.c.addGroup("foo the bar", {}, this.rootPath);

        this.c.filterGroup(/test/);
{'fraction_non_alphanumeric': 0.16646054909720504, 'fraction_numerical': 0.007420232500618353, 'mean_word_length': 2.892204042348412, 'pattern_counts': {'":': 12, '<': 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': '7639308', 'n_tokens_mistral': 1266, 'n_tokens_neox': 1216, 'n_words': 253}