<commit_before>/*! resol-vbus | Copyright (c) 2013-2014, <NAME> | MIT license */
'use strict';



var _ = require('lodash');
var Q = require('q');


var vbus = require('../resol-vbus');

var testUtils = require('../test-utils');



var optimizerPromise = vbus.ConfigurationOptimizerFactory.getOptimizerByDeviceAddress(0x7112);



describe('ResolDeltaSolBxPlusXxxConfigurationOptimizer', function() {

    describe('using ConfigurationOptimizerFactory', function() {

        promiseIt('should work correctly', function() {
            return testUtils.expectPromise(optimizerPromise).then(function(optimizer) {
                expect(optimizer).an('object');
            });
        });

    });

    describe('#getInitialLoadConfiguration', function() {

        promiseIt('should work correctly', function() {
            return optimizerPromise.then(function(optimizer) {
                return Q.fcall(function() {
                    return testUtils.expectPromise(optimizer.getInitialLoadConfiguration());
                }).then(function(config) {
                    expect(config).an('array');
                    expect(_.where(config, { pending: true })).lengthOf(159);
                });
            });
        });

    });

    describe('#optimizeLoadConfiguration', function() {

        promiseIt('should work correctly after', function() {
            return optimizerPromise.then(function(optimizer) {
                return Q.fcall(function() {
                    return testUtils.expectPromise(optimizer.getInitialLoadConfiguration());
                }).then(function(config) {
                    _.forEach(config, function(value) {
                        if (value.pending) {
                            value.pending = false;
                            value.transceived = true;
                            value.value = null;
                        }
                    });

                    return testUtils.expectPromise(optimizer.optimizeLoadConfiguration(config));
                }).then(function(config) {
                    expect(config).an('array');
                    var valueIds = _.pluck(_.where(config, { pending: true }), 'valueId');
                    console.log(valueIds);
                    expect(valueIds).lengthOf(9);
                });
            });
        });

    });

});<commit_msg>Remove debug output from RESOL DeltaSol BX Plus tests.<commit_after>/*! resol-vbus | Copyright (c) 2013-2014, <NAME> | MIT license */
'use strict';



var _ = require('lodash');
var Q = require('q');


var vbus = require('../resol-vbus');

var testUtils = require('../test-utils');



var optimizerPromise = vbus.ConfigurationOptimizerFactory.getOptimizerByDeviceAddress(0x7112);



describe('ResolDeltaSolBxPlusXxxConfigurationOptimizer', function() {

    describe('using ConfigurationOptimizerFactory', function() {

        promiseIt('should work correctly', function() {
            return testUtils.expectPromise(optimizerPromise).then(function(optimizer) {
                expect(optimizer).an('object');
            });
        });

    });

    describe('#getInitialLoadConfiguration', function() {

        promiseIt('should work correctly', function() {
            return optimizerPromise.then(function(optimizer) {
                return Q.fcall(function() {
                    return testUtils.expectPromise(optimizer.getInitialLoadConfiguration());
                }).then(function(config) {
                    expect(config).an('array');
                    expect(_.where(config, { pending: true })).lengthOf(159);
                });
            });
        });

    });

    describe('#optimizeLoadConfiguration', function() {

        promiseIt('should work correctly after', function() {
            return optimizerPromise.then(function(optimizer) {
                return Q.fcall(function() {
                    return testUtils.expectPromise(optimizer.getInitialLoadConfiguration());
                }).then(function(config) {
                    _.forEach(config, function(value) {
                        if (value.pending) {
                            value.pending = false;
                            value.transceived = true;
                            value.value = null;
                        }
                    });

                    return testUtils.expectPromise(optimizer.optimizeLoadConfiguration(config));
                }).then(function(config) {
                    expect(config).an('array');
                    var valueIds = _.pluck(_.where(config, { pending: true }), 'valueId');
                    expect(valueIds).lengthOf(9);
                });
            });
        });

    });

});
{'fraction_non_alphanumeric': 0.1270212765957447, 'fraction_numerical': 0.00723404255319149, 'mean_word_length': 1.8664634146341463, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '1224776', 'n_tokens_mistral': 1205, 'n_tokens_neox': 1105, 'n_words': 187}