diff options
author | Joseph Frazer <joseph.frazer@ryansg.com> | 2018-08-15 15:05:21 -0400 |
---|---|---|
committer | Joseph Frazer <joseph.frazer@ryansg.com> | 2018-08-15 15:05:21 -0400 |
commit | 4b1fda57b8cbfca0f049dc4ef182300fdc176f0b (patch) | |
tree | f80783c3e899927234b9b7dd18541253440b4638 /test | |
parent | eb980f4fb777b3ec337e9ab03062317d30af5269 (diff) | |
download | liza-4b1fda57b8cbfca0f049dc4ef182300fdc176f0b.tar.gz liza-4b1fda57b8cbfca0f049dc4ef182300fdc176f0b.tar.bz2 liza-4b1fda57b8cbfca0f049dc4ef182300fdc176f0b.zip |
[DEV-3393] minor changes to improve code quality
Diffstat (limited to 'test')
-rw-r--r-- | test/client/quote/ClientQuoteTest.js | 60 | ||||
-rw-r--r-- | test/quote/BaseQuoteTest.js | 21 |
2 files changed, 31 insertions, 50 deletions
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', () => - { - expect( quote ).to.be.an.instanceof( ClientQuote ); - } ); - - it( 'getStartDate proxy', () => + it( 'getStartDate returns base quote startDate', () => { - expect( quote.getStartDate ).to.not.be.undefined; - expect( quote.getStartDate() ).to.equal( startDate ); + expect( quote.getStartDate() ).to.equal( start_date ); } ); - it( 'getAgentId proxy', () => + it( 'getAgentId returns base quote agentId', () => { - expect( quote.getAgentId ).to.not.be.undefined; - expect( quote.getAgentId() ).to.equal( agentId ); + expect( quote.getAgentId() ).to.equal( agent_id ); } ); - it( 'getAgentName proxy', () => + it( 'getAgentName returns base quote agentName', () => { - expect( quote.getAgentName ).to.not.be.undefined; - expect( quote.getAgentName() ).to.equal( agentName ); + expect( quote.getAgentName() ).to.equal( agent_name ); } ); - it( 'getAgentEntityId proxy', () => + it( 'getAgentEntityId returns base quote agentEntityId', () => { - expect( quote.getAgentEntityId ).to.not.be.undefined; - expect( quote.getAgentEntityId() ).to.equal( agentEntityId ); + expect( quote.getAgentEntityId() ).to.equal( agent_entity_id ); } ); - it( 'getInitialRatedDate proxy', () => + it( 'getInitialRatedDate returns base quote initialRatedDate', () => { - 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 ); } ); |