@@ -92,11 +92,55 @@ describe('MedianOracle:pushReport', async function () {
9292 it ( 'should only push from authorized source' , async function ( ) {
9393 await expect ( oracle . connect ( A ) . pushReport ( payload ) ) . to . be . reverted
9494 } )
95- it ( 'should fail if reportDelaySec did not pass since the previous push' , async function ( ) {
95+
96+ it ( 'should pass if reportDelaySec did not pass since the previous push, but previous report non-existent' , async function ( ) {
97+ await oracle . addProvider ( await A . getAddress ( ) )
98+ await oracle . connect ( A ) . pushReport ( payload )
99+ await oracle . connect ( A ) . pushReport ( payload )
100+ } )
101+
102+ it ( 'should pass if reportDelaySec did pass since the previous push, and previous report non-existent' , async function ( ) {
96103 await oracle . addProvider ( await A . getAddress ( ) )
97104 await oracle . connect ( A ) . pushReport ( payload )
105+ await increaseTime ( 20 )
106+ await oracle . connect ( A ) . pushReport ( payload )
107+ } )
108+
109+ it ( 'should pass if reportDelaySec did pass since the previous push, but previous report expired' , async function ( ) {
110+ await oracle . addProvider ( await A . getAddress ( ) )
111+ await oracle . connect ( A ) . pushReport ( payload )
112+ await increaseTime ( 70 )
113+ await oracle . connect ( A ) . pushReport ( payload )
114+ await oracle . connect ( A ) . pushReport ( payload )
115+ } )
116+
117+ it ( 'should pass if reportDelaySec did pass since the previous push, and previous report expired' , async function ( ) {
118+ await oracle . addProvider ( await A . getAddress ( ) )
119+ await oracle . connect ( A ) . pushReport ( payload )
120+ await increaseTime ( 70 )
121+ await oracle . connect ( A ) . pushReport ( payload )
122+ await increaseTime ( 20 )
123+ await oracle . connect ( A ) . pushReport ( payload )
124+ } )
125+
126+ it ( 'should fail if reportDelaySec did not pass since the previous push, and previous report not expired' , async function ( ) {
127+ await oracle . addProvider ( await A . getAddress ( ) )
128+ await oracle . connect ( A ) . pushReport ( payload )
129+ await increaseTime ( 20 )
130+ await oracle . connect ( A ) . pushReport ( payload )
131+ await expect ( oracle . connect ( A ) . pushReport ( payload ) ) . to . be . reverted
132+ } )
133+
134+ it ( 'should pass if reportDelaySec did pass since the previous push, and previous report not expired' , async function ( ) {
135+ await oracle . addProvider ( await A . getAddress ( ) )
136+ await oracle . connect ( A ) . pushReport ( payload )
137+ await increaseTime ( 20 )
138+ await oracle . connect ( A ) . pushReport ( payload )
139+ await increaseTime ( 20 )
140+ await oracle . connect ( A ) . pushReport ( payload )
98141 await expect ( oracle . connect ( A ) . pushReport ( payload ) ) . to . be . reverted
99142 } )
143+
100144 it ( 'should emit ProviderReportPushed message' , async function ( ) {
101145 oracle . addProvider ( await A . getAddress ( ) )
102146 const tx = await oracle . connect ( A ) . pushReport ( payload )
0 commit comments