Mike Gerwitz

Activist for User Freedom

aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAustin Schaffer <austin.schaffer@ryansg.com>2019-06-11 14:42:31 -0400
committerChase Gregory <chase.gregory@ryansg.com>2019-06-14 10:40:46 -0400
commit723a7f7ff76e0b7a35a0c3e589bb06420d6dbd9a (patch)
tree72bc9f801ef3bfea16dfde7d164505963eb92be5 /test
parent2f0fea8f490f7eaa043b5cd4c32645678e8f518f (diff)
downloadliza-723a7f7ff76e0b7a35a0c3e589bb06420d6dbd9a.tar.gz
liza-723a7f7ff76e0b7a35a0c3e589bb06420d6dbd9a.tar.bz2
liza-723a7f7ff76e0b7a35a0c3e589bb06420d6dbd9a.zip
[DEV-5333] Expose initialRatedDate to the client from the bucket
[DEV-5333] WIP Add RateEventHandlerTest and fix RatingServiceSubmitNotifyTest WIP: Add RateEventHandlerTest Add stubs for RateEventHandlerTest Finish RateEventHandlerTest Move done to fix test bug
Diffstat (limited to 'test')
-rw-r--r--test/client/event/RateEventHandlerTest.js81
-rw-r--r--test/server/service/RatingServiceSubmitNotifyTest.js2
2 files changed, 82 insertions, 1 deletions
diff --git a/test/client/event/RateEventHandlerTest.js b/test/client/event/RateEventHandlerTest.js
new file mode 100644
index 0000000..7cbc3a6
--- /dev/null
+++ b/test/client/event/RateEventHandlerTest.js
@@ -0,0 +1,81 @@
+/**
+ * Tests RateEventHandler
+ *
+ * Copyright (C) 2019, 2019 R-T Specialty, LLC.
+ *
+ * This file is part of the Liza Data Collection Framework.
+ *
+ * liza is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+'use strict';
+
+const { expect } = require( 'chai' );
+const Sut = require( '../../..' ).client.event.RateEventHandler;
+
+describe( 'RateEventHandler', () =>
+{
+ describe( "Handle Rating Event", () =>
+ {
+ it( "calls #handle to do the rating", done =>
+ {
+ const stepId = 0;
+ const lockStep = 1;
+ const indv = "somerater";
+
+ const quote = {
+ getExplicitLockStep: () => lockStep,
+ setInitialRatedDate: ( value ) => {},
+ getCurrentStepId: () => stepId,
+ refreshData: () => {},
+ isLocked: () => false
+ };
+
+ const step = {
+ invalidate: () => {}
+ };
+
+ const ui = {
+ getStep: ( dest ) => step
+ };
+
+ const client = {
+ getQuote: () => quote,
+ isSaving: () => false,
+ once: ( event, callback ) => {},
+ getUi: () => ui
+ };
+
+ const response = {
+ content: {
+ data: "Some Data"
+ }
+ };
+
+ const error = "ERROR";
+
+ const proxy = {
+ get: ( url, callback ) => callback( response, error )
+ };
+
+ const sut = Sut( client, proxy );
+
+ sut.handle( "", function() {}, {
+ indv: indv,
+ stepId: stepId
+ } );
+ done();
+ } )
+ } )
+} )
diff --git a/test/server/service/RatingServiceSubmitNotifyTest.js b/test/server/service/RatingServiceSubmitNotifyTest.js
index d053755..80e0bc3 100644
--- a/test/server/service/RatingServiceSubmitNotifyTest.js
+++ b/test/server/service/RatingServiceSubmitNotifyTest.js
@@ -179,8 +179,8 @@ describe( 'RatingServiceSubmitNotify', () =>
// only save notification status if we're notifying
expect( notify_saved ).to.equal( expected.save );
- done();
} );
+ done();
} )
);
} );