Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/system/EventMediatorTest.ts18
1 files changed, 12 insertions, 6 deletions
diff --git a/test/system/EventMediatorTest.ts b/test/system/EventMediatorTest.ts
index 581437c..caab191 100644
--- a/test/system/EventMediatorTest.ts
+++ b/test/system/EventMediatorTest.ts
@@ -96,27 +96,33 @@ describe( 'system.EventLogger captures and logs events', () =>
expect( method_called ).to.be.true;
} );
- it( 'context is retrieved from error', () =>
+ it( 'context and stack are retrieved from error', () =>
{
let method_called = false;
const event_id = 'error';
const err_msg = 'Foo';
+ const stub_err = new Error( err_msg );
const emitter = new EventEmitter();
const log = createMockLogger();
const err_context = { bar: 'baz' };
+ const expected_context = {
+ bar: err_context.bar,
+ stack: stub_err.stack,
+ };
+
log.error = ( str: string, context: any ) =>
{
- method_called = true;
-
expect( str ).to.equal( err_msg );
- expect( context ).to.equal( err_context );
+ expect( context ).to.deep.equal( expected_context );
+
+ method_called = true;
};
new Sut( log, emitter );
- emitter.emit( event_id, context( new Error( err_msg ), err_context ) );
+ emitter.emit( event_id, context( stub_err, err_context ) );
expect( method_called ).to.be.true;
} );
@@ -136,4 +142,4 @@ function createMockLogger(): PsrLogger
emergency( _msg: string | object, _context: object ){},
log( _level: any, _msg: string | object, _context: object ){},
};
-} \ No newline at end of file
+}