You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the test in file src/api/rest/tests/MQRestClient.unit.test.ts
describe("ZosmfRestClient tests", () => {
it("should delete stack from any zosmf errors before presenting them to users", () => {
const zosmfRestClient = new MQRestClient(new Session({hostname: "dummy"}));
const shouldNotDeleteMessage = "This should not be deleted";
const shouldDeleteMessage = "This should be deleted";
const error: IImperativeError = {
msg: "hello",
causeErrors: JSON.stringify({
stack: shouldDeleteMessage,
shouldNotDelete: shouldNotDeleteMessage
})
};
const processedError = ((zosmfRestClient as any).processError(error));
expect(processedError.msg).toContain(shouldNotDeleteMessage);
expect(processedError.msg.indexOf()).toEqual(-1);
});
});
the line expect(processedError.msg.indexOf()).toEqual(-1); doesnt actually check the message has been deleted, it just happens that the default behaviour is to return -1
In the test in file src/api/rest/tests/MQRestClient.unit.test.ts
the line
expect(processedError.msg.indexOf()).toEqual(-1);
doesnt actually check the message has been deleted, it just happens that the default behaviour is to return -1potential fix:
expect(processedError.msg.indexOf(shouldDeleteMessage)).toEqual(-1);
The text was updated successfully, but these errors were encountered: