/* global describe, it, expect */
/* jshint expr: true */

var millipede   = require('../lib');

// ## //

describe('millipede', function () {
    describe('default values', function () {
        it('should default to 20 if the size is undefined', function () {
            expect(millipede().size).to.equal(20);
        });

        it('should not be reversed by default', function () {
            expect(millipede().reverse).to.be.false;
        });
    });

    describe('validation', function () {
        it('should throw if the size is too great', function () {
            var run = function () { millipede(100001); };

            expect(run).to.throw(millipede.MillipedeValidationError);
        });
    });

    describe('render', function () {
        it('should render a millipede of size 1', function () {
            expect(millipede(1).toString()).to.equal([
                '    ╚⊙ ⊙╝',
                '  ╚═(███)═╝'
            ].join('\n'));
        });

        it('should render a millipede of size 24', function () {
            expect(millipede(24).toString()).to.equal([
                '    ╚⊙ ⊙╝',
                '  ╚═(███)═╝',
                ' ╚═(███)═╝',
                '╚═(███)═╝',
                ' ╚═(███)═╝',
                '  ╚═(███)═╝',
                '   ╚═(███)═╝',
                '    ╚═(███)═╝',
                '    ╚═(███)═╝',
                '   ╚═(███)═╝',
                '  ╚═(███)═╝',
                ' ╚═(███)═╝',
                '╚═(███)═╝',
                ' ╚═(███)═╝',
                '  ╚═(███)═╝',
                '   ╚═(███)═╝',
                '    ╚═(███)═╝',
                '    ╚═(███)═╝',
                '   ╚═(███)═╝',
                '  ╚═(███)═╝',
                ' ╚═(███)═╝',
                '╚═(███)═╝',
                ' ╚═(███)═╝',
                '  ╚═(███)═╝',
                '   ╚═(███)═╝'
           ].join('\n'));
        });
    });
});

@@ -1906,13 +1906,537 @@
 %0A    %7D);
+%0A%0A    describe('mutability', function () %7B%0A        var m = millipede(1);%0A%0A        it('should display a forward millipede of 1', function () %7B%0A            expect(m.toString()).to.equal(%5B%0A                '    %E2%95%9A%E2%8A%99 %E2%8A%99%E2%95%9D',%0A                '  %E2%95%9A%E2%95%90(%E2%96%88%E2%96%88%E2%96%88)%E2%95%90%E2%95%9D'%0A            %5D.join('%5Cn'));%0A        %7D);%0A%0A        it('should reverse the millipede', function () %7B%0A            m.reverse = true;%0A%0A            expect(m.toString()).to.equal(%5B%0A                '   %E2%95%94%E2%95%90(%E2%96%88%E2%96%88%E2%96%88)%E2%95%90%E2%95%97',%0A                '     %E2%95%94%E2%8A%99 %E2%8A%99%E2%95%97'%0A            %5D.join('%5Cn'));%0A        %7D);%0A    %7D);
 %0A%7D);%0A

Test millipede mutability