<commit_before>var buster = require("buster");
var assert = buster.assert;
var a = require("../../lib/buster-terminal").align;

buster.testCase("Terminal string align test", {
    "max width": {
        "should get width of array of strings": function () {
            assert.equals(a.maxWidth(["a", "b", "hey", "there"]), 5);
        },

        "should get width of array of strings and numbers": function () {
            assert.equals(a.maxWidth(["a", 666782, 2, "there"]), 6);
        },

        "should count width of undefined as 0": function () {
            assert.equals(a.maxWidth([null, undefined, false, ""]), 5);
        }
    },

    "alignment": {
        "should left align text": function () {
            assert.equals(a.alignLeft("Hey there", 13), "Hey there    ");
        },

        "should right align text": function () {
            assert.equals(a.alignRight("Hey there", 13), "    Hey there");
        }
    }
});
<commit_msg>Add test for aligning too long strings<commit_after>var buster = require("buster");
var assert = buster.assert;
var a = require("../../lib/buster-terminal").align;

buster.testCase("Terminal string align test", {
    "max width": {
        "should get width of array of strings": function () {
            assert.equals(a.maxWidth(["a", "b", "hey", "there"]), 5);
        },

        "should get width of array of strings and numbers": function () {
            assert.equals(a.maxWidth(["a", 666782, 2, "there"]), 6);
        },

        "should count width of undefined as 0": function () {
            assert.equals(a.maxWidth([null, undefined, false, ""]), 5);
        }
    },

    "alignment": {
        "should left align text": function () {
            assert.equals(a.alignLeft("Hey there", 13), "Hey there    ");
        },

        "should right align text": function () {
            assert.equals(a.alignRight("Hey there", 13), "    Hey there");
        },

        "should not pad too long text": function () {
            assert.equals(a.alignRight("Hey there", 4), "Hey there");
        }
    }
});

{'fraction_non_alphanumeric': 0.16851762433606954, 'fraction_numerical': 0.01496861419604056, 'mean_word_length': 2.262992125984252, 'pattern_counts': {'":': 15, '<': 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': '346497', 'n_tokens_mistral': 638, 'n_tokens_neox': 593, 'n_words': 170}