Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2019-11-25 12:42:03 -0500
committerAustin Schaffer <austin.schaffer@ryansg.com>2019-11-25 12:42:03 -0500
commit5ee9a5d3409c07e59644a5680a818c2c301eba77 (patch)
tree45aa911b4231ab5185e9ab3e8168af932a8da99d /test/system/DeltaPublisherTest.ts
parente781a841b177cdb330c3ae4ec453ec4010ce8470 (diff)
downloadliza-5ee9a5d3409c07e59644a5680a818c2c301eba77.tar.gz
liza-5ee9a5d3409c07e59644a5680a818c2c301eba77.tar.bz2
liza-5ee9a5d3409c07e59644a5680a818c2c301eba77.zip
[DEV-5312] Generalize event subscribers and dispatchers
Diffstat (limited to 'test/system/DeltaPublisherTest.ts')
-rw-r--r--test/system/DeltaPublisherTest.ts29
1 files changed, 14 insertions, 15 deletions
diff --git a/test/system/DeltaPublisherTest.ts b/test/system/DeltaPublisherTest.ts
index da9a553..cf3872f 100644
--- a/test/system/DeltaPublisherTest.ts
+++ b/test/system/DeltaPublisherTest.ts
@@ -19,12 +19,11 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-import { EventDispatcher } from '../../src/system/event/EventDispatcher';
import { DeltaPublisher as Sut } from '../../src/system/DeltaPublisher';
import { AmqpConfig } from '../../src/system/AmqpPublisher';
+import { EventEmitter } from "events";
import { expect, use as chai_use } from 'chai';
-import { EventEmitter } from "events";
chai_use( require( 'chai-as-promised' ) );
@@ -34,10 +33,10 @@ describe( 'server.DeltaPublisher', () =>
{
it( 'sends a message', () =>
{
- const conf = createMockConf();
- const dispatcher = new EventDispatcher( new EventEmitter() );
+ const conf = createMockConf();
+ const emitter = new EventEmitter();
- console.log( new Sut( conf, dispatcher, ts_ctr ) );
+ console.log( new Sut( conf, emitter, ts_ctr ) );
expect( true ).to.be.true
} );
} );
@@ -46,10 +45,10 @@ describe( 'server.DeltaPublisher', () =>
{
it( 'sends a message', () =>
{
- const conf = createMockConf();
- const dispatcher = new EventDispatcher( new EventEmitter() );
+ const conf = createMockConf();
+ const emitter = new EventEmitter();
- console.log( new Sut( conf, dispatcher, ts_ctr ) );
+ console.log( new Sut( conf, emitter, ts_ctr ) );
expect( true ).to.be.true
} );
} );
@@ -140,8 +139,8 @@ describe( 'server.DeltaPublisher', () =>
{
let errorCalled = false;
- const dispatcher = <EventDispatcher>{
- dispatch( _event_id, _err )
+ const emitter = <EventEmitter>{
+ emit( _event_id, _err )
{
errorCalled = true;
@@ -151,7 +150,7 @@ describe( 'server.DeltaPublisher', () =>
const conf = createMockConf();
const data = createMockData( delta_data );
- const sut = new Sut( conf, dispatcher, ts_ctr );
+ const sut = new Sut( conf, emitter, ts_ctr );
const buffer = sut.avroEncode( data );
if ( valid )
@@ -302,10 +301,10 @@ describe( 'server.DeltaPublisher', () =>
{
it( label, () =>
{
- const dispatcher = <EventDispatcher>{}
- const conf = createMockConf();
- const sut = new Sut( conf, dispatcher, ts_ctr );
- const actual = sut.avroFormat( delta_data );
+ const emitter = <EventEmitter>{}
+ const conf = createMockConf();
+ const sut = new Sut( conf, emitter, ts_ctr );
+ const actual = sut.avroFormat( delta_data );
expect( actual ).to.deep.equal( expected );
} );