@@ -30,7 +30,7 @@ describe('and canInvestByUser', () => {
3030
3131 const expected : jest . Mocked < IRentalInvestorValidator > = {
3232 canInvest : false ,
33- results : [ new UserInvestResult ( InvestmentReasons . PropertyIsAlreadyOwned ) ] ,
33+ results : [ new UserInvestResult ( InvestmentReasons . PropertyIsAlreadyOwned , '' , [ ] ) ] ,
3434 } as jest . Mocked < IRentalInvestorValidator > ;
3535
3636 const actual = canInvestByUser ( instance , null , today , null ) ;
@@ -62,8 +62,8 @@ describe('and canInvestByUser', () => {
6262 const expected : IRentalInvestorValidator = {
6363 canInvest : false ,
6464 results : [
65- new UserInvestResult ( InvestmentReasons . UserHasNoMoneyToInvest , 'user balance: 0' ) ,
66- new UserInvestResult ( InvestmentReasons . UserHasNotSavedEnoughMoney , 'user balance: 0, minimumSavings: 1' ) ,
65+ new UserInvestResult ( InvestmentReasons . UserHasNoMoneyToInvest , 'user balance: 0' , [ { value : 0 , name : 'balance' } ] ) ,
66+ new UserInvestResult ( InvestmentReasons . UserHasNotSavedEnoughMoney , 'user balance: 0, minimumSavings: 1' , [ { value : 0 , name : 'balance' } ] ) ,
6767 ] ,
6868 } ;
6969
@@ -98,7 +98,7 @@ describe('and canInvestByUser', () => {
9898 const expected : IRentalInvestorValidator = {
9999 canInvest : false ,
100100 results : [
101- new UserInvestResult ( InvestmentReasons . UserHasNotSavedEnoughMoney , 'user balance: 0, minimumSavings: 1' ) ,
101+ new UserInvestResult ( InvestmentReasons . UserHasNotSavedEnoughMoney , 'user balance: 0, minimumSavings: 1' , [ { value : 0 , name : 'balance' } ] ) ,
102102 ] ,
103103 } ;
104104
@@ -123,7 +123,7 @@ describe('and canInvestByUser', () => {
123123
124124 const expected : IRentalInvestorValidator = {
125125 canInvest : false ,
126- results : [ new UserInvestResult ( InvestmentReasons . NoRules , 'user has no purchase rules' ) ] ,
126+ results : [ new UserInvestResult ( InvestmentReasons . NoRules , 'user has no purchase rules' , [ ] ) ] ,
127127 } ;
128128
129129 expect ( canInvestByUser ( instance , user , today , null ) ) . toMatchObject ( expected ) ;
@@ -162,14 +162,14 @@ describe('and canInvestByUser', () => {
162162 const expected : IRentalInvestorValidator = {
163163 canInvest : false ,
164164 results : [
165- new UserInvestResult (
166- InvestmentReasons . DoesNotMeetUserRuleAskingPrice ,
167- `rule: 20000 property: ${ instance . purchasePrice } `
168- ) ,
169- new UserInvestResult (
170- InvestmentReasons . DoesNotMeetUserRuleOutOfPocket ,
171- `rule: 50000 property: ${ instance . costDownPrice } `
172- ) ,
165+ new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleAskingPrice , `rule: 20000 property: ${ instance . purchasePrice } ` , [
166+ { value : 20000 , name : 'rule' } ,
167+ { value : instance . purchasePrice , name : 'property' } ,
168+ ] ) ,
169+ new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleOutOfPocket , `rule: 50000 property: ${ instance . costDownPrice } ` , [
170+ { value : 50000 , name : 'rule' } ,
171+ { value : instance . costDownPrice , name : 'property' } ,
172+ ] ) ,
173173 ] ,
174174 } ;
175175
@@ -291,8 +291,14 @@ describe('and canInvestByUser', () => {
291291 const expected : IRentalInvestorValidator = {
292292 canInvest : false ,
293293 results : [
294- new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleEquityCapture , 'rule: 50000 property: 25687.5' ) ,
295- new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleEquityCapture , 'rule: 50000 property: 188000' ) ,
294+ new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleEquityCapture , 'rule: 50000 property: 25687.5' , [
295+ { name : 'rule' , value : 50000 } ,
296+ { name : 'property' , value : 25687.5 } ,
297+ ] ) ,
298+ new UserInvestResult ( InvestmentReasons . DoesNotMeetUserRuleEquityCapture , 'rule: 50000 property: 188000' , [
299+ { name : 'rule' , value : 50000 } ,
300+ { name : 'property' , value : 188000 } ,
301+ ] ) ,
296302 ] ,
297303 } ;
298304
0 commit comments