/**
 * HTTP.test
 */

"use strict";


/* Node modules */


/* Third-party modules */
var steeplejack = require("steeplejack");


/* Files */


describe("HTTPError test", function () {

    var HTTPError;
    beforeEach(function () {

        injector(function (_HTTPError_) {
            HTTPError = _HTTPError_;
        });

    });

    describe("Instantation tests", function () {

        it("should extend the steeplejack Fatal exception", function () {

            var obj = new HTTPError("text");

            expect(obj).to.be.instanceof(HTTPError)
                .to.be.instanceof(steeplejack.Exceptions.Fatal);

            expect(obj.type).to.be.equal("HTTPError");
            expect(obj.message).to.be.equal("text");
            expect(obj.httpCode).to.be.equal(500);
            expect(obj.getHttpCode()).to.be.equal(500);

        });

        it("should set the HTTP code in the first input", function () {

            var obj = new HTTPError(401);

            expect(obj.httpCode).to.be.equal(401);
            expect(obj.getHttpCode()).to.be.equal(401);

        });

    });

});
