MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / test_clearInterval

Function test_clearInterval

tests/python/test_event_loop.py:35–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

33
34
35def test_clearInterval():
36 async def async_fn():
37 obj = {'val': 0}
38 pm.eval("""(obj) => {
39 const interval = setInterval(()=>{ obj.val++ }, 200)
40 setTimeout(()=>{ clearInterval(interval) }, 500)
41 }""")(obj)
42 await pm.wait() # It should stop after 500ms on the clearInterval
43 assert obj['val'] == 2 # The setInterval timer should only run twice (500 // 200 == 2)
44 return True
45 assert asyncio.run(async_fn())
46
47
48def test_finished_timer_ref():

Callers

nothing calls this directly

Calls 1

async_fnFunction · 0.70

Tested by

no test coverage detected