A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/app/scripts/lib/cleanErrorStack.test.js

37 lines
1008 B

import cleanErrorStack from './cleanErrorStack';
6 years ago
describe('Clean Error Stack', () => {
const testMessage = 'Test Message';
const testError = new Error(testMessage);
const undefinedErrorName = new Error(testMessage);
const blankErrorName = new Error(testMessage);
const blankMsgError = new Error();
6 years ago
beforeEach(() => {
undefinedErrorName.name = undefined;
blankErrorName.name = '';
});
6 years ago
it('tests error with message', () => {
expect(cleanErrorStack(testError).toString()).toStrictEqual(
'Error: Test Message',
);
});
6 years ago
it('tests error with undefined name', () => {
expect(cleanErrorStack(undefinedErrorName).toString()).toStrictEqual(
'Error: Test Message',
);
});
6 years ago
it('tests error with blank name', () => {
expect(cleanErrorStack(blankErrorName).toString()).toStrictEqual(
'Test Message',
);
});
6 years ago
it('tests error with blank message', () => {
expect(cleanErrorStack(blankMsgError).toString()).toStrictEqual('Error');
});
});