Currently, in the ink test environment (ink_env::test), the default block time is 6 (see https://github.com/paritytech/ink/blame/50b32f4e49d4072f3d28009eb517475b68bec56b/crates/engine/src/ext.rs#L147) as mentionned in the code, this is arbitrary, but this value is not close to any real value (as it is expressed in ms...)
So currently, to do some testing when I need to test timestamps from the environment I have to do something like this :
#[ink::test]
fn sign_up_after_end_of_sign_up_period_returns_error() {
// preparing the test
//default block time is 6 (in ms)
for _ in 0..10000 {
ink_env::test::advance_block::<ink_env::DefaultEnvironment>();
}
//acting and asserting the test
}
I wonder if there is a way to (simply) override the DefaultEnvironment's blocktime without to creating my own test environment type just to control that value.
This is because it would make sense in my tests to use the block_time value (that cannot be extracted from ink_env::test). To have a more precise way to advance blocks and test the usage of the block timestamp.