UNPKG

@magic.batua/error

Version:

The Error module powers the error handling features of the Magic Batua.

40 lines 1.66 kB
"use strict"; // // index.spec.ts // Magic-Error // // Created on February 16, 2018 by Animesh Mishra <hello@animesh.ltd> // © 2018 Magic Batua. All Rights Reserved. // Object.defineProperty(exports, "__esModule", { value: true }); const Chai = require("chai"); const ClientError_1 = require("../Source/ClientError"); const Code_1 = require("../Source/Code"); const ExternalError_1 = require("../Source/ExternalError"); const expect = Chai.expect; describe("◊◊◊ Error ◊◊◊", function () { it("Should initialise ClientError correctly", function () { let error = new ClientError_1.ClientError(Code_1.Code.BadRequest, "Test error", "Testing"); expect(error).to.have.property("code").equal(400); }); it("Should export ClientError correctly", function () { let error = new ClientError_1.ClientError(Code_1.Code.BadRequest, "Test error", "Testing"); expect(error.Export()).to.deep.equal({ message: "Test error", help: "Testing" }); }); it("Should initialise ExternalError correctly", function () { let error = new ExternalError_1.ExternalError("Test message", "Test provider", "Testing help"); expect(error).to.have.property("code").equal(424); }); it("Should export ExternalError correctly", function () { let error = new ExternalError_1.ExternalError("Test message", "Test provider", "Testing help"); expect(error.Export()).to.deep.equal({ message: "Test message", serviceProvider: "Test provider", help: "Testing help" }); }); }); //# sourceMappingURL=index.spec.js.map