[DEV-3393] Merge branch 'jira-3393' of gitlab.lovullo.com:floss/liza into jira-3393
commit
dc39c636a4
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Client-side quote
|
* Client-side quote
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 R-T Specialty, LLC.
|
* Copyright (C) 2017, 2018 R-T Specialty, LLC.
|
||||||
*
|
*
|
||||||
* This file is part of the Liza Data Collection Framework.
|
* This file is part of the Liza Data Collection Framework.
|
||||||
*
|
*
|
||||||
|
@ -135,6 +135,10 @@ module.exports = Class( 'ClientQuote' )
|
||||||
.setCurrentStepId( data.currentStepId || 0 )
|
.setCurrentStepId( data.currentStepId || 0 )
|
||||||
.setTopVisitedStepId( data.topVisitedStepId || 0 )
|
.setTopVisitedStepId( data.topVisitedStepId || 0 )
|
||||||
.setAgentId( data.agentId || 0 )
|
.setAgentId( data.agentId || 0 )
|
||||||
|
.setAgentName( data.agentName || "" )
|
||||||
|
.setAgentEntityId( data.agentEntityId || "" )
|
||||||
|
.setStartDate( data.startDate || 0 )
|
||||||
|
.setInitialRatedDate( data.initialRatedDate || 0 )
|
||||||
.setImported( data.imported || false )
|
.setImported( data.imported || false )
|
||||||
.setBound( data.bound || false )
|
.setBound( data.bound || false )
|
||||||
.needsImport( data.needsImport || false )
|
.needsImport( data.needsImport || false )
|
||||||
|
@ -553,6 +557,14 @@ module.exports = Class( 'ClientQuote' )
|
||||||
'public proxy getStartDate': '_quote',
|
'public proxy getStartDate': '_quote',
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the quote's initial rated date
|
||||||
|
*
|
||||||
|
* @return {number} quote's initial rated date
|
||||||
|
*/
|
||||||
|
'public proxy getInitialRatedDate': '_quote',
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the id of the agent that owns the quote
|
* Returns the id of the agent that owns the quote
|
||||||
*
|
*
|
||||||
|
@ -561,6 +573,22 @@ module.exports = Class( 'ClientQuote' )
|
||||||
'public proxy getAgentId': '_quote',
|
'public proxy getAgentId': '_quote',
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the agent that owns the quote
|
||||||
|
*
|
||||||
|
* @return {string} agent name
|
||||||
|
*/
|
||||||
|
'public proxy getAgentName': '_quote',
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the entity id of the agent that owns the quote
|
||||||
|
*
|
||||||
|
* @return {string} agent entity id
|
||||||
|
*/
|
||||||
|
'public proxy getAgentEntityId': '_quote',
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the quote has been imported
|
* Returns whether the quote has been imported
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/**
|
/**
|
||||||
* Contains program Quote class
|
* Contains program Quote class
|
||||||
*
|
*
|
||||||
* Copyright (C) 2017 R-T Specialty, LLC.
|
* Copyright (C) 2017, 2018 R-T Specialty, LLC.
|
||||||
*
|
*
|
||||||
* This file is part of the Liza Data Collection Framework.
|
* This file is part of the Liza Data Collection Framework.
|
||||||
*
|
*
|
||||||
|
@ -75,17 +75,29 @@ module.exports = Class( 'BaseQuote' )
|
||||||
'private _program': null,
|
'private _program': null,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Date (UNIX timestamp) that the quote was started
|
* Date (Unix timestamp) that the quote was started
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
'private _startDate': 0,
|
'private _startDate': 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Date (Unix timestamp) that the quote was initially rated
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
'private _initialRatedDate': 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Id of agent that owns the quote
|
* Id of agent that owns the quote
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
'private _agentId': 0,
|
'private _agentId': 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Id of agent entity that owns the quote
|
||||||
|
* @type {number}
|
||||||
|
*/
|
||||||
|
'private _agentEntityId': 0,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Agency name
|
* Agency name
|
||||||
* @type {string}
|
* @type {string}
|
||||||
|
@ -213,7 +225,7 @@ module.exports = Class( 'BaseQuote' )
|
||||||
/**
|
/**
|
||||||
* Sets the quote start date
|
* Sets the quote start date
|
||||||
*
|
*
|
||||||
* @param {number} time start date as a UNIX timestamp
|
* @param {number} time start date as a Unix timestamp
|
||||||
*
|
*
|
||||||
* @return {Quote} self
|
* @return {Quote} self
|
||||||
*/
|
*/
|
||||||
|
@ -235,6 +247,30 @@ module.exports = Class( 'BaseQuote' )
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the quote's initial rated date
|
||||||
|
*
|
||||||
|
* @param {number} time initial rated date as a Unix timestamp
|
||||||
|
*
|
||||||
|
* @return {Quote} self
|
||||||
|
*/
|
||||||
|
'public setInitialRatedDate': function( time )
|
||||||
|
{
|
||||||
|
this._initialRatedDate = +( time );
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the quote's initial rated date
|
||||||
|
*
|
||||||
|
* @return {number} quote's initial rated date
|
||||||
|
*/
|
||||||
|
'public getInitialRatedDate': function()
|
||||||
|
{
|
||||||
|
return this._initialRatedDate;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets id of agent that owns the quote
|
* Sets id of agent that owns the quote
|
||||||
*
|
*
|
||||||
|
@ -260,6 +296,31 @@ module.exports = Class( 'BaseQuote' )
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets id of agent entity that owns the quote
|
||||||
|
*
|
||||||
|
* @param {number} id agent entity id
|
||||||
|
*
|
||||||
|
* @return {Quote} self
|
||||||
|
*/
|
||||||
|
'public setAgentEntityId': function( id )
|
||||||
|
{
|
||||||
|
this._agentEntityId = +id;
|
||||||
|
return this;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the id of the agent entity that owns the quote
|
||||||
|
*
|
||||||
|
* @return {number} agent entity id
|
||||||
|
*/
|
||||||
|
'public getAgentEntityId': function()
|
||||||
|
{
|
||||||
|
return this._agentEntityId;
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets name of agent that owns the quote
|
* Sets name of agent that owns the quote
|
||||||
*
|
*
|
||||||
|
|
|
@ -326,6 +326,8 @@ module.exports = Class( 'Server' )
|
||||||
.setQuickSaveData( quote_data.quicksave || {} )
|
.setQuickSaveData( quote_data.quicksave || {} )
|
||||||
.setAgentId( quote_data.agentId || agent_id )
|
.setAgentId( quote_data.agentId || agent_id )
|
||||||
.setAgentName( quote_data.agentName || agent_name )
|
.setAgentName( quote_data.agentName || agent_name )
|
||||||
|
.setAgentEntityId( quote_data.agentEntityId || "" )
|
||||||
|
.setInitialRatedDate( quote_data.initialRatedDate || 0 )
|
||||||
.setStartDate(
|
.setStartDate(
|
||||||
quote_data.getStartDate
|
quote_data.getStartDate
|
||||||
|| Math.round( new Date().getTime() / 1000 )
|
|| Math.round( new Date().getTime() / 1000 )
|
||||||
|
@ -739,6 +741,9 @@ module.exports = Class( 'Server' )
|
||||||
explicitLockStepId: lock_step,
|
explicitLockStepId: lock_step,
|
||||||
agentId: quote.getAgentId(),
|
agentId: quote.getAgentId(),
|
||||||
agentName: quote.getAgentName(),
|
agentName: quote.getAgentName(),
|
||||||
|
agentEntityId: ( internal ) ? quote.getAgentEntityId() : 0,
|
||||||
|
startDate: quote.getStartDate(),
|
||||||
|
initialRatedDate: quote.getInitialRatedDate(),
|
||||||
|
|
||||||
quicksave: quote.getQuickSaveData(),
|
quicksave: quote.getQuickSaveData(),
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
* Tests ClientQuote
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 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 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 General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const chai = require( 'chai' );
|
||||||
|
const expect = chai.expect;
|
||||||
|
const { BaseQuote } = require( '../../../' ).quote;
|
||||||
|
const { ClientQuote } = require( '../../../' ).client.quote;
|
||||||
|
const { QuoteDataBucket } = require( '../../../' ).bucket;
|
||||||
|
|
||||||
|
describe( 'ClientQuote', () =>
|
||||||
|
{
|
||||||
|
const base_quote = BaseQuote( 123, QuoteDataBucket() );
|
||||||
|
const start_date = 12345;
|
||||||
|
const agent_id = 90000;
|
||||||
|
const agent_name = 'John Doe';
|
||||||
|
const agent_entity_id = 12434300;
|
||||||
|
const initial_rated_date = 1531507748;
|
||||||
|
const quote = ClientQuote(
|
||||||
|
base_quote,
|
||||||
|
{
|
||||||
|
startDate: start_date,
|
||||||
|
agentId: agent_id,
|
||||||
|
agentName: agent_name,
|
||||||
|
agentEntityId: agent_entity_id,
|
||||||
|
initialRatedDate: initial_rated_date,
|
||||||
|
},
|
||||||
|
bucket => bucket
|
||||||
|
);
|
||||||
|
|
||||||
|
it( 'getStartDate returns base quote startDate', () =>
|
||||||
|
{
|
||||||
|
expect( quote.getStartDate() ).to.equal( start_date );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'getAgentId returns base quote agentId', () =>
|
||||||
|
{
|
||||||
|
expect( quote.getAgentId() ).to.equal( agent_id );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'getAgentName returns base quote agentName', () =>
|
||||||
|
{
|
||||||
|
expect( quote.getAgentName() ).to.equal( agent_name );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'getAgentEntityId returns base quote agentEntityId', () =>
|
||||||
|
{
|
||||||
|
expect( quote.getAgentEntityId() ).to.equal( agent_entity_id );
|
||||||
|
} );
|
||||||
|
|
||||||
|
it( 'getInitialRatedDate returns base quote initialRatedDate', () =>
|
||||||
|
{
|
||||||
|
expect( quote.getInitialRatedDate() ).to.equal( initial_rated_date );
|
||||||
|
} );
|
||||||
|
} );
|
|
@ -0,0 +1,58 @@
|
||||||
|
/**
|
||||||
|
* Tests BaseQuote
|
||||||
|
*
|
||||||
|
* Copyright (C) 2018 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 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 General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
const chai = require( 'chai' );
|
||||||
|
const expect = chai.expect;
|
||||||
|
const { BaseQuote } = require( '../../' ).quote;
|
||||||
|
|
||||||
|
describe( 'BaseQuote', () =>
|
||||||
|
{
|
||||||
|
[
|
||||||
|
{
|
||||||
|
property: 'startDate',
|
||||||
|
value: 12345
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: 'initialRatedDate',
|
||||||
|
value: 12345
|
||||||
|
},
|
||||||
|
{
|
||||||
|
property: 'agentEntityId',
|
||||||
|
value: 12434300
|
||||||
|
},
|
||||||
|
].forEach( testCase =>
|
||||||
|
{
|
||||||
|
const quote = BaseQuote( 123, {} );
|
||||||
|
const property = testCase.property;
|
||||||
|
const title_cased = property.charAt( 0 ).toUpperCase() + property.slice( 1 );
|
||||||
|
const setter = 'set' + title_cased;
|
||||||
|
const getter = 'get' + title_cased;
|
||||||
|
|
||||||
|
it( property + ' can be mutated and accessed', () =>
|
||||||
|
{
|
||||||
|
expect( quote[getter].call( null ) ).to.be.undefined;
|
||||||
|
quote[setter].call( null, testCase.value );
|
||||||
|
expect( quote[getter].call( null ) ).to.equal( testCase.value );
|
||||||
|
} );
|
||||||
|
} );
|
||||||
|
} );
|
Loading…
Reference in New Issue