From d0a3ba573f32760e72f356e468f2a2c32eb1306c Mon Sep 17 00:00:00 2001 From: Mike Gerwitz Date: Mon, 9 Dec 2019 15:21:34 -0500 Subject: [PATCH] DeltaProcessor: Remove redundant tests These are covered by other tests and are testing too closely to the implementation. This should be encapsulated within the processor. --- src/system/DeltaProcessor.ts | 4 +- test/system/DeltaProcessorTest.ts | 146 ------------------------------ 2 files changed, 2 insertions(+), 148 deletions(-) diff --git a/src/system/DeltaProcessor.ts b/src/system/DeltaProcessor.ts index 7433bd8..fbb85ac 100644 --- a/src/system/DeltaProcessor.ts +++ b/src/system/DeltaProcessor.ts @@ -84,7 +84,7 @@ export class DeltaProcessor private _processDocument( doc: DeltaDocument ): Promise { - const deltas = this.getTimestampSortedDeltas( doc ); + const deltas = this._getTimestampSortedDeltas( doc ); const doc_id = doc.id; const bucket = doc.data; const ratedata = doc.ratedata; @@ -153,7 +153,7 @@ export class DeltaProcessor * * @return a list of deltas sorted by timestamp */ - getTimestampSortedDeltas( doc: DeltaDocument ): Delta[] + private _getTimestampSortedDeltas( doc: DeltaDocument ): Delta[] { const data_deltas = this.getDeltas( doc, this.DELTA_RATEDATA ); const ratedata_deltas = this.getDeltas( doc, this.DELTA_DATA ); diff --git a/test/system/DeltaProcessorTest.ts b/test/system/DeltaProcessorTest.ts index 3998d68..07e288c 100644 --- a/test/system/DeltaProcessorTest.ts +++ b/test/system/DeltaProcessorTest.ts @@ -32,152 +32,6 @@ chai_use( require( 'chai-as-promised' ) ); describe( 'system.DeltaProcessor', () => { - describe( '#getTimestampSortedDeltas', () => - { - ( <{ label: string, given: any, expected: any }[]>[ - { - label: 'creates list', - given: { - rdelta: { - data: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - }, - ], - ratedata: [ - { - data: { foo: [ 'third_bar' ] }, - timestamp: 345, - }, - { - data: { foo: [ 'fourth_bar' ] }, - timestamp: 456, - }, - ] - } - }, - expected: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - type: 'data', - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - type: 'data', - }, - { - data: { foo: [ 'third_bar' ] }, - timestamp: 345, - type: 'ratedata', - }, - { - data: { foo: [ 'fourth_bar' ] }, - timestamp: 456, - type: 'ratedata', - }, - ], - }, - { - label: 'creates list with no ratedata', - given: { - rdelta: { - data: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - }, - ], - ratedata: [] - } - }, - expected: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - type: 'data', - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - type: 'data', - }, - ], - }, - { - label: 'creates list when rate occurs between two saves', - given: { - rdelta: { - data: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - }, - { - data: { foo: [ 'fourth_bar' ] }, - timestamp: 456, - }, - ], - ratedata: [ - { - data: { foo: [ 'third_bar' ] }, - timestamp: 345, - }, - ], - }, - }, - expected: [ - { - data: { foo: [ 'first_bar' ] }, - timestamp: 123, - type: 'data', - }, - { - data: { foo: [ 'second_bar' ] }, - timestamp: 234, - type: 'data', - }, - { - data: { foo: [ 'third_bar' ] }, - timestamp: 345, - type: 'ratedata', - }, - { - data: { foo: [ 'fourth_bar' ] }, - timestamp: 456, - type: 'data', - }, - ], - }, - ] ).forEach( ( { given, expected, label } ) => it( label, () => - { - const sut = new Sut( - createMockDeltaDao(), - createMockDeltaPublisher(), - new EventEmitter(), - ); - - const actual = sut.getTimestampSortedDeltas( given ); - - expect( actual ).to.deep.equal( expected ); - } ) ); - } ); - - describe( '#getDeltas', () => { ( <{