1
0
Fork 0

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.
master
Mike Gerwitz 2019-12-09 15:21:34 -05:00 committed by Austin Schaffer
parent 8e0c0e22a8
commit d0a3ba573f
2 changed files with 2 additions and 148 deletions

View File

@ -84,7 +84,7 @@ export class DeltaProcessor
private _processDocument( doc: DeltaDocument ): Promise<void>
{
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<any>[]
private _getTimestampSortedDeltas( doc: DeltaDocument ): Delta<any>[]
{
const data_deltas = this.getDeltas( doc, this.DELTA_RATEDATA );
const ratedata_deltas = this.getDeltas( doc, this.DELTA_DATA );

View File

@ -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', () =>
{
( <{