/
eb
/
Surf
Обзор
Документация
Войти
/
eb
/
Surf
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
node_modules/make-error-cause/dist/index.spec.js
25 строк
1 KB
EvgeniyBudaev
Initial commit
17 фев 2020, 09:02
17 фев 2020, 09:02
bb6f06f
Код
Авторство
О чём код?
"use strict"; var test = require('blue-tape'); var makeErrorCause = require('./index'); test('make error cause', function (t) { var TestError = makeErrorCause('TestError'); var SubTestError = makeErrorCause('SubTestError', TestError); t.test('render the cause', function (t) { var cause = new Error('boom!'); var error = new TestError('something bad', cause); var again = new SubTestError('more bad', error); t.equal(error.cause, cause); t.equal(error.toString(), 'TestError: something bad\nCaused by: Error: boom!'); t.ok(error instanceof Error); t.ok(error instanceof makeErrorCause.BaseError); t.ok(error instanceof TestError); t.equal(again.cause, error); t.equal(again.toString(), 'SubTestError: more bad\nCaused by: TestError: something bad\nCaused by: Error: boom!'); t.ok(again instanceof Error); t.ok(again instanceof makeErrorCause.BaseError); t.ok(again instanceof TestError); t.ok(again instanceof SubTestError); t.end(); }); }); //# sourceMappingURL=index.spec.js.map