From 4b1fda57b8cbfca0f049dc4ef182300fdc176f0b Mon Sep 17 00:00:00 2001 From: Joseph Frazer Date: Wed, 15 Aug 2018 15:05:21 -0400 Subject: [PATCH] [DEV-3393] minor changes to improve code quality --- src/client/quote/ClientQuote.js | 2 +- src/quote/BaseQuote.js | 2 +- test/client/quote/ClientQuoteTest.js | 60 +++++++++++----------------- test/quote/BaseQuoteTest.js | 21 ++++------ 4 files changed, 33 insertions(+), 52 deletions(-) diff --git a/src/client/quote/ClientQuote.js b/src/client/quote/ClientQuote.js index acdcfb0..ced0ce1 100644 --- a/src/client/quote/ClientQuote.js +++ b/src/client/quote/ClientQuote.js @@ -1,7 +1,7 @@ /** * 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. * diff --git a/src/quote/BaseQuote.js b/src/quote/BaseQuote.js index 319fc4e..9947dea 100644 --- a/src/quote/BaseQuote.js +++ b/src/quote/BaseQuote.js @@ -1,7 +1,7 @@ /** * 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. * diff --git a/test/client/quote/ClientQuoteTest.js b/test/client/quote/ClientQuoteTest.js index 1c8f308..cb3ad46 100644 --- a/test/client/quote/ClientQuoteTest.js +++ b/test/client/quote/ClientQuoteTest.js @@ -1,7 +1,7 @@ /** * 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. * @@ -27,60 +27,48 @@ const { BaseQuote } = require( '../../../' ).quote; const { ClientQuote } = require( '../../../' ).client.quote; const { QuoteDataBucket } = require( '../../../' ).bucket; -chai.use( require( 'chai-as-promised' ) ); - describe( 'ClientQuote', () => { - const baseQuote = BaseQuote( 123, QuoteDataBucket() ), - startDate = 12345, - agentId = 90000, - agentName = 'John Doe', - agentEntityId = '12434300', - initialRatedDate = 1531507748, - quote = ClientQuote( - baseQuote, + 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: startDate, - agentId: agentId, - agentName: agentName, - agentEntityId: agentEntityId, - initialRatedDate: initialRatedDate, + startDate: start_date, + agentId: agent_id, + agentName: agent_name, + agentEntityId: agent_entity_id, + initialRatedDate: initial_rated_date, }, 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.getStartDate() ).to.equal( startDate ); + expect( quote.getAgentId() ).to.equal( agent_id ); } ); - it( 'getAgentId proxy', () => + it( 'getAgentName returns base quote agentName', () => { - expect( quote.getAgentId ).to.not.be.undefined; - expect( quote.getAgentId() ).to.equal( agentId ); + expect( quote.getAgentName() ).to.equal( agent_name ); } ); - it( 'getAgentName proxy', () => + it( 'getAgentEntityId returns base quote agentEntityId', () => { - expect( quote.getAgentName ).to.not.be.undefined; - expect( quote.getAgentName() ).to.equal( agentName ); + expect( quote.getAgentEntityId() ).to.equal( agent_entity_id ); } ); - it( 'getAgentEntityId proxy', () => + it( 'getInitialRatedDate returns base quote initialRatedDate', () => { - expect( quote.getAgentEntityId ).to.not.be.undefined; - expect( quote.getAgentEntityId() ).to.equal( agentEntityId ); - } ); - - it( 'getInitialRatedDate proxy', () => - { - expect( quote.getInitialRatedDate ).to.not.be.undefined; - expect( quote.getInitialRatedDate() ).to.equal( initialRatedDate ); + expect( quote.getInitialRatedDate() ).to.equal( initial_rated_date ); } ); } ); diff --git a/test/quote/BaseQuoteTest.js b/test/quote/BaseQuoteTest.js index 746cbd7..401e3d9 100644 --- a/test/quote/BaseQuoteTest.js +++ b/test/quote/BaseQuoteTest.js @@ -1,7 +1,7 @@ /** * 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. * @@ -25,8 +25,6 @@ const chai = require( 'chai' ); const expect = chai.expect; const { BaseQuote } = require( '../../' ).quote; -chai.use( require( 'chai-as-promised' ) ); - describe( 'BaseQuote', () => { [ @@ -44,20 +42,15 @@ describe( 'BaseQuote', () => }, ].forEach( testCase => { - const quote = BaseQuote( 123, {} ), - property = testCase.property, - titleCased = property.charAt( 0 ).toUpperCase() + property.slice( 1 ), - setter = 'set' + titleCased, - getter = 'get' + titleCased; + 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, () => + 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; - quote[setter].call( null, testCase.value ); expect( quote[getter].call( null ) ).to.equal( testCase.value ); } );