We do integration test for our logic in nakama javascript runtime, we tried to test tournament cycle that really need to wait time to pass,
For now we shorten the cycle duration for 1 minute, but it became tedious to wait integration test waiting for 1 minutes for each case,
Can we use something like jest time travel / useFakeTimer? Would it work well with nakama framework?
Thanks
Hello @doaortu,
I’m not familiar with “time traveling” libs in the JS ecosystem, but I assume they monkey patch the relevant stdlib objects and/or functions, or do something in a similar vein - these would only affect your JS custom code, not Nakama, as internally it’ll use Go’s stdlib functions to manage timers to trigger the tournament hooks.
Given that these are asynchronous operations, the only next best thing to avoid waiting I can suggest, would be to make it a “hybrid” test, exposing the hook function via RPCs in dev env that gets called as part of the integration test - you’d have to mock the inputs that are passed to the function.
Best.