File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
mithril-aggregator/src/database/repository Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -209,6 +209,34 @@ mod tests {
209
209
}
210
210
}
211
211
212
+ #[ tokio:: test]
213
+ async fn repository_get_expired_open_message ( ) {
214
+ let connection = get_connection ( ) . await ;
215
+ let repository = OpenMessageRepository :: new ( connection. clone ( ) ) ;
216
+ let epoch = Epoch ( 1 ) ;
217
+ let signed_entity_type = SignedEntityType :: MithrilStakeDistribution ( epoch) ;
218
+
219
+ let mut open_message = repository
220
+ . create_open_message ( epoch, & signed_entity_type, & ProtocolMessage :: new ( ) )
221
+ . await
222
+ . unwrap ( ) ;
223
+
224
+ let open_message_result = repository
225
+ . get_expired_open_message ( & signed_entity_type)
226
+ . await
227
+ . unwrap ( ) ;
228
+ assert ! ( open_message_result. is_none( ) ) ;
229
+
230
+ open_message. expires_at = Some ( Utc :: now ( ) - chrono:: Days :: new ( 100 ) ) ;
231
+ repository. update_open_message ( & open_message) . await . unwrap ( ) ;
232
+
233
+ let open_message_result = repository
234
+ . get_expired_open_message ( & signed_entity_type)
235
+ . await
236
+ . unwrap ( ) ;
237
+ assert ! ( open_message_result. is_some( ) ) ;
238
+ }
239
+
212
240
#[ tokio:: test]
213
241
async fn repository_create_open_message ( ) {
214
242
let connection = get_connection ( ) . await ;
You can’t perform that action at this time.
0 commit comments