RatingService#postProcessRaterData: Fix accidental indvRate change
I accidentally changed id=>after when prototyping data for the _new_ deferred rating (not yet written). There were no tests for this code, which was originally written in July of 2012 (see private lovullo.git repo), so it was not caught until QA.master
parent
d2f9f5f18f
commit
f0e246deef
|
@ -346,7 +346,7 @@ export class RatingService
|
|||
|
||||
meta.deferred.forEach( ( alias: string ) =>
|
||||
{
|
||||
actions.push( { action: 'indvRate', after: alias } );
|
||||
actions.push( { action: 'indvRate', id: alias } );
|
||||
torate.push( alias );
|
||||
} );
|
||||
|
||||
|
|
|
@ -194,6 +194,52 @@ describe( 'RatingService', () =>
|
|||
} );
|
||||
|
||||
|
||||
// this means of deferred rating is deprecated and is being superceded
|
||||
// in the near future by a better system; it will hopefully be removed
|
||||
// at some point
|
||||
it( "sends indvRate action for old-style deferred suppliers", () =>
|
||||
{
|
||||
const {
|
||||
dao,
|
||||
logger,
|
||||
quote,
|
||||
raters,
|
||||
request,
|
||||
response,
|
||||
server,
|
||||
stub_rate_data,
|
||||
} = getStubs();
|
||||
|
||||
let sent = false;
|
||||
|
||||
stub_rate_data._cmpdata = {
|
||||
deferred: [ 'supp1', 'supp2' ],
|
||||
};
|
||||
|
||||
server.sendResponse = (
|
||||
_request: any,
|
||||
_quote: any,
|
||||
_resp: any,
|
||||
actions: ClientActions
|
||||
) =>
|
||||
{
|
||||
expect( actions ).to.deep.equal( [
|
||||
{ action: 'indvRate', id: 'supp1' },
|
||||
{ action: 'indvRate', id: 'supp2' },
|
||||
] );
|
||||
|
||||
sent = true;
|
||||
|
||||
return server;
|
||||
};
|
||||
|
||||
const sut = new Sut( logger, dao, server, raters );
|
||||
|
||||
return sut.request( request, response, quote, "" )
|
||||
.then( () => expect( sent ).to.be.true );
|
||||
} );
|
||||
|
||||
|
||||
describe( "protected API", () =>
|
||||
{
|
||||
it( "calls #postProcessRaterData after rating before save", done =>
|
||||
|
|
Loading…
Reference in New Issue