mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 23:58:06 +01:00
92971d3c87
* Update eslint-plugin-import version * Convert JS files to use ESM * Update ESLint rules to check imports * Fix test:unit:global command env * Cleanup mock-dev script
34 lines
950 B
JavaScript
34 lines
950 B
JavaScript
import assert from 'assert'
|
|
import cleanErrorStack from '../../../app/scripts/lib/cleanErrorStack'
|
|
|
|
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()
|
|
|
|
beforeEach(() => {
|
|
undefinedErrorName.name = undefined
|
|
blankErrorName.name = ''
|
|
})
|
|
|
|
it('tests error with message', () => {
|
|
assert.equal(cleanErrorStack(testError), 'Error: Test Message')
|
|
})
|
|
|
|
it('tests error with undefined name', () => {
|
|
assert.equal(cleanErrorStack(undefinedErrorName).toString(), 'Error: Test Message')
|
|
})
|
|
|
|
it('tests error with blank name', () => {
|
|
assert.equal(cleanErrorStack(blankErrorName).toString(), 'Test Message')
|
|
})
|
|
|
|
it('tests error with blank message', () => {
|
|
assert.equal(cleanErrorStack(blankMsgError), 'Error')
|
|
})
|
|
|
|
})
|