Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-31 11:21:01 -0400
committerMike Gerwitz <mike.gerwitz@rtspecialty.com>2019-10-31 11:21:01 -0400
commitf0e246deef1e10f382cafcd36eca89620a8f6ace (patch)
tree5275eef1de8a7ff1f8ab2607b99a38b8484fea18 /test
parentd2f9f5f18f027f9436414db85494726da9a5c092 (diff)
downloadliza-f0e246deef1e10f382cafcd36eca89620a8f6ace.tar.gz
liza-f0e246deef1e10f382cafcd36eca89620a8f6ace.tar.bz2
liza-f0e246deef1e10f382cafcd36eca89620a8f6ace.zip
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.
Diffstat (limited to 'test')
-rw-r--r--test/server/service/RatingServiceTest.ts46
1 files changed, 46 insertions, 0 deletions
diff --git a/test/server/service/RatingServiceTest.ts b/test/server/service/RatingServiceTest.ts
index fd659d6..7bab2e4 100644
--- a/test/server/service/RatingServiceTest.ts
+++ b/test/server/service/RatingServiceTest.ts
@@ -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 =>