Not sure if this is helpful @rabi-siddique , but I noticed a few things here that may or may not be relevant.
1) When isolating it, i see what you mean, timer is undefined in some tests, and not in others
2) I noticed the timer in the terms was not always available.
3) was able to isolate it to here:
4) I also see @Chris-Hibbert 's await await observation, and that might have caused an issue too when you trying to access the timer from promise space const timerService = await await chainTimerServiceP; -- its awaiting the promise, and then awaiting the things thats resolved from the promise.
5) it might have been some confusion when you are doing things with the timer inside of the contract, and outside of it, sometimes I have to make sure I am handling those object right in my test flow -- like this. When using E here, it was undefined, as you mentioned.
await E(timer).getCurrentTimestamp();
6) Notice my debugger lines here, it helped me step through the flow to see when exactly timer was defined and undefined. This may be helpful moving forward on this.
These logs don't show the issue anymore. The issue wasn't the contract ,it was the test trying to access the timer to invoke it
I Now see @turadg branch, I think I ended up down a similar path
These following tests logs don't show this error anymore:
TypeError#1: Cannot deliver getCurrentTimestamp to target; typeof target is undefined
As i debugged it, where you see my random console.logs() as I was thinking, those helped me see where and when timer was there and not @rabi-siddique with the javascript debugger stepping over each line
Not sure if this is helpful @rabi-siddique , but I noticed a few things here that may or may not be relevant.
1) When isolating it, i see what you mean, timer is undefined in some tests, and not in others 2) I noticed the timer in the terms was not always available. 3) was able to isolate it to here:
4) I also see @Chris-Hibbert 's
await await
observation, and that might have caused an issue too when you trying to access the timer from promise spaceconst timerService = await await chainTimerServiceP;
-- its awaiting the promise, and then awaiting the things thats resolved from the promise. 5) it might have been some confusion when you are doing things with the timer inside of the contract, and outside of it, sometimes I have to make sure I am handling those object right in my test flow -- like this. When usingE
here, it was undefined, as you mentioned.6) Notice my
debugger
lines here, it helped me step through the flow to see when exactly timer was defined andundefined
. This may be helpful moving forward on this.These logs don't show the issue anymore. The issue wasn't the contract ,it was the test trying to access the timer to invoke it
I Now see @turadg branch, I think I ended up down a similar path
These following tests logs don't show this error anymore:
idk if this is progress, but wanted to put my notes somewhere