1
0
Fork 0

[DEV-3393] minor changes to improve code quality

master
Joseph Frazer 2018-08-15 15:05:21 -04:00
parent eb980f4fb7
commit 4b1fda57b8
4 changed files with 33 additions and 52 deletions

View File

@ -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.
* *

View File

@ -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.
* *

View File

@ -1,7 +1,7 @@
/** /**
* Tests ClientQuote * Tests ClientQuote
* *
* Copyright (C) 2017 R-T Specialty, LLC. * Copyright (C) 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.
* *
@ -27,60 +27,48 @@ const { BaseQuote } = require( '../../../' ).quote;
const { ClientQuote } = require( '../../../' ).client.quote; const { ClientQuote } = require( '../../../' ).client.quote;
const { QuoteDataBucket } = require( '../../../' ).bucket; const { QuoteDataBucket } = require( '../../../' ).bucket;
chai.use( require( 'chai-as-promised' ) );
describe( 'ClientQuote', () => describe( 'ClientQuote', () =>
{ {
const baseQuote = BaseQuote( 123, QuoteDataBucket() ), const base_quote = BaseQuote( 123, QuoteDataBucket() );
startDate = 12345, const start_date = 12345;
agentId = 90000, const agent_id = 90000;
agentName = 'John Doe', const agent_name = 'John Doe';
agentEntityId = '12434300', const agent_entity_id = '12434300';
initialRatedDate = 1531507748, const initial_rated_date = 1531507748;
quote = ClientQuote( const quote = ClientQuote(
baseQuote, base_quote,
{ {
startDate: startDate, startDate: start_date,
agentId: agentId, agentId: agent_id,
agentName: agentName, agentName: agent_name,
agentEntityId: agentEntityId, agentEntityId: agent_entity_id,
initialRatedDate: initialRatedDate, initialRatedDate: initial_rated_date,
}, },
bucket => bucket bucket => bucket
); );
it( 'constructor', () => it( 'getStartDate returns base quote startDate', () =>
{ {
expect( quote ).to.be.an.instanceof( ClientQuote ); expect( quote.getStartDate() ).to.equal( start_date );
} ); } );
it( 'getStartDate proxy', () => it( 'getAgentId returns base quote agentId', () =>
{ {
expect( quote.getStartDate ).to.not.be.undefined; expect( quote.getAgentId() ).to.equal( agent_id );
expect( quote.getStartDate() ).to.equal( startDate );
} ); } );
it( 'getAgentId proxy', () => it( 'getAgentName returns base quote agentName', () =>
{ {
expect( quote.getAgentId ).to.not.be.undefined; expect( quote.getAgentName() ).to.equal( agent_name );
expect( quote.getAgentId() ).to.equal( agentId );
} ); } );
it( 'getAgentName proxy', () => it( 'getAgentEntityId returns base quote agentEntityId', () =>
{ {
expect( quote.getAgentName ).to.not.be.undefined; expect( quote.getAgentEntityId() ).to.equal( agent_entity_id );
expect( quote.getAgentName() ).to.equal( agentName );
} ); } );
it( 'getAgentEntityId proxy', () => it( 'getInitialRatedDate returns base quote initialRatedDate', () =>
{ {
expect( quote.getAgentEntityId ).to.not.be.undefined; expect( quote.getInitialRatedDate() ).to.equal( initial_rated_date );
expect( quote.getAgentEntityId() ).to.equal( agentEntityId );
} );
it( 'getInitialRatedDate proxy', () =>
{
expect( quote.getInitialRatedDate ).to.not.be.undefined;
expect( quote.getInitialRatedDate() ).to.equal( initialRatedDate );
} ); } );
} ); } );

View File

@ -1,7 +1,7 @@
/** /**
* Tests BaseQuote * Tests BaseQuote
* *
* Copyright (C) 2017 R-T Specialty, LLC. * Copyright (C) 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.
* *
@ -25,8 +25,6 @@ const chai = require( 'chai' );
const expect = chai.expect; const expect = chai.expect;
const { BaseQuote } = require( '../../' ).quote; const { BaseQuote } = require( '../../' ).quote;
chai.use( require( 'chai-as-promised' ) );
describe( 'BaseQuote', () => describe( 'BaseQuote', () =>
{ {
[ [
@ -44,20 +42,15 @@ describe( 'BaseQuote', () =>
}, },
].forEach( testCase => ].forEach( testCase =>
{ {
const quote = BaseQuote( 123, {} ), const quote = BaseQuote( 123, {} );
property = testCase.property, const property = testCase.property;
titleCased = property.charAt( 0 ).toUpperCase() + property.slice( 1 ), const title_cased = property.charAt( 0 ).toUpperCase() + property.slice( 1 );
setter = 'set' + titleCased, const setter = 'set' + title_cased;
getter = 'get' + titleCased; const getter = 'get' + title_cased;
it( property, () => it( property + ' can be mutated and accessed', () =>
{ {
expect( quote ).to.be.an.instanceof( BaseQuote );
expect( quote[setter] ).to.not.be.undefined;
expect( quote[getter] ).to.not.be.undefined;
expect( quote[getter].call( null ) ).to.be.undefined; expect( quote[getter].call( null ) ).to.be.undefined;
quote[setter].call( null, testCase.value ); quote[setter].call( null, testCase.value );
expect( quote[getter].call( null ) ).to.equal( testCase.value ); expect( quote[getter].call( null ) ).to.equal( testCase.value );
} ); } );