How to write test for scriptable with JEST

Hi there

I am going to write unit tests for my scriptable extension with JEST. However, it will return a Syntax Error Unexpected reserved word 'await' (28:0) since there is a Top-level await in the script on line 28.

The test will be fixed if I modify await main() to main() but the result will not be my expected if run it on scriprable. Any solution that I can run my test without syntax error along with await main()

The test file. download-video.test.js