@@ -67,7 +67,7 @@ describe('TrueCreditAgency', () => {
67
67
timeTravel = ( time : number ) => _timeTravel ( _provider , time )
68
68
provider = _provider
69
69
70
- ; ( {
70
+ ; ( {
71
71
standardToken : tusd ,
72
72
standardPool : tusdPool ,
73
73
feeToken : usdc ,
@@ -101,9 +101,17 @@ describe('TrueCreditAgency', () => {
101
101
expect ( await creditAgency . creditOracle ( ) ) . to . equal ( creditOracle . address )
102
102
} )
103
103
104
+ it ( 'sets rateAdjuster' , async ( ) => {
105
+ expect ( await creditAgency . rateAdjuster ( ) ) . to . equal ( rateAdjuster . address )
106
+ } )
107
+
104
108
it ( 'sets interestRepaymentPeriod' , async ( ) => {
105
109
expect ( await creditAgency . interestRepaymentPeriod ( ) ) . to . equal ( MONTH )
106
110
} )
111
+
112
+ it ( 'sets maxPools to 10' , async ( ) => {
113
+ expect ( await creditAgency . maxPools ( ) ) . to . equal ( 10 )
114
+ } )
107
115
} )
108
116
109
117
describe ( 'Ownership' , ( ) => {
@@ -157,6 +165,24 @@ describe('TrueCreditAgency', () => {
157
165
} )
158
166
} )
159
167
168
+ describe ( 'setMaxPools' , ( ) => {
169
+ it ( 'reverts if not called by the owner' , async ( ) => {
170
+ await expect ( creditAgency . connect ( borrower ) . setMaxPools ( 1 ) )
171
+ . to . be . revertedWith ( 'Ownable: caller is not the owner' )
172
+ } )
173
+
174
+ it ( 'changes maximum pools capacity' , async ( ) => {
175
+ await creditAgency . setMaxPools ( 1 )
176
+ expect ( await creditAgency . maxPools ( ) ) . to . eq ( 1 )
177
+ } )
178
+
179
+ it ( 'emits event' , async ( ) => {
180
+ await expect ( creditAgency . setMaxPools ( 1 ) )
181
+ . to . emit ( creditAgency , 'MaxPoolsChanged' )
182
+ . withArgs ( 1 )
183
+ } )
184
+ } )
185
+
160
186
describe ( 'Borrower allowance' , ( ) => {
161
187
it ( 'only owner can set allowance' , async ( ) => {
162
188
await expect ( creditAgency . connect ( borrower ) . allowBorrower ( borrower . address , true ) )
@@ -185,7 +211,14 @@ describe('TrueCreditAgency', () => {
185
211
}
186
212
}
187
213
it ( 'can only be called by the owner' , async ( ) => {
188
- await expect ( creditAgency . connect ( borrower ) . allowPool ( tusdPool . address , true ) ) . to . be . revertedWith ( 'Ownable: caller is not the owner' )
214
+ await expect ( creditAgency . connect ( borrower ) . allowPool ( tusdPool . address , true ) )
215
+ . to . be . revertedWith ( 'Ownable: caller is not the owner' )
216
+ } )
217
+
218
+ it ( 'reverts if there are too many pools' , async ( ) => {
219
+ await creditAgency . setMaxPools ( 1 )
220
+ await expect ( creditAgency . allowPool ( usdcPool . address , true ) )
221
+ . to . be . revertedWith ( 'TrueRatingAgency: Pools number has reached the limit' )
189
222
} )
190
223
191
224
it ( 'changes pool allowance status' , async ( ) => {
0 commit comments