Skip to content

Commit

Permalink
fix: fix / update UTs for generic exception handling
Browse files Browse the repository at this point in the history
Fix update unit tests for generic exception handling to match new log
helper returns

Closes: hyperledger-cacti#1702
Signed-off-by: Michael Courtin <michael.courtin@accenture.com>
  • Loading branch information
m-courtin committed Jan 4, 2022
1 parent 0331e48 commit e74f635
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import "jest-extended";
import { LogHelper } from "../../../../main/typescript/logging/log-helper";

describe("log-helper tests", () => {
const no_message_available = "NO_MESSAGE_AVAILABLE";
const no_stack_available = "NO_STACK_AVAILABLE";
const no_message_available = "NO_MESSAGE_INCLUDED_IN_EXCEPTION";
const no_stack_available = "NO_STACK_INFORMATION_INCLUDED_IN_EXCEPTION";
const errorMessage = "Oops";

describe("exception stack-tests", () => {
Expand Down Expand Up @@ -64,7 +64,7 @@ describe("log-helper tests", () => {
});

it("gets no stack information as the faked Error object is not containing any stack information", () => {
const expectedResult = "";
const expectedResult = no_stack_available;
let stack = no_stack_available;

const fakeErrorWithoutStack = {
Expand All @@ -81,8 +81,8 @@ describe("log-helper tests", () => {
expect(stack).toBe(expectedResult);
});

it("handles throwing null successfully and returns empty string stack", () => {
const expectedResult = "";
it("handles throwing null successfully and returns NO_STACK_INFORMATION_INCLUDED_IN_EXCEPTION string", () => {
const expectedResult = no_stack_available;
let stack = no_stack_available;

const fakeError = null;
Expand All @@ -97,8 +97,8 @@ describe("log-helper tests", () => {
expect(stack).toBe(expectedResult);
});

it("handles throwing undefined successfully and returns empty string stack", () => {
const expectedResult = "";
it("handles throwing undefined successfully and returns NO_STACK_INFORMATION_INCLUDED_IN_EXCEPTION string", () => {
const expectedResult = no_stack_available;
let stack = no_stack_available;

const fakeError = undefined;
Expand Down Expand Up @@ -167,8 +167,8 @@ describe("log-helper tests", () => {
expect(message).toBe(expectedResult);
});

it("gets no exception message information as the faked Error object is not containing any message information", () => {
const expectedResult = "";
it("gets no exception message information as the faked Error object is not containing any message information and therefore returning NO_MESSAGE_INCLUDED_IN_EXCEPTION", () => {
const expectedResult = no_message_available;
let message = no_message_available;

const fakeErrorWithoutMessage = {
Expand All @@ -185,8 +185,8 @@ describe("log-helper tests", () => {
expect(message).toBe(expectedResult);
});

it("handles throwing null successfully and returns empty string message", () => {
const expectedResult = "";
it("handles throwing null successfully and returning NO_MESSAGE_INCLUDED_IN_EXCEPTION string", () => {
const expectedResult = no_message_available;
let message = no_message_available;

const fakeError = null;
Expand All @@ -201,8 +201,8 @@ describe("log-helper tests", () => {
expect(message).toBe(expectedResult);
});

it("handles throwing undefined successfully and returns empty string message", () => {
const expectedResult = "";
it("handles throwing undefined successfully and returning NO_MESSAGE_INCLUDED_IN_EXCEPTION string", () => {
const expectedResult = no_message_available;
let message = no_message_available;

const fakeError = undefined;
Expand Down

0 comments on commit e74f635

Please sign in to comment.