File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
packages/npm-packages/ruby-wasm-wasi/test/unit Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ def await
87
87
unless sched
88
88
raise "Please start Ruby evaluation with RubyVM.eval_async to use JS::Object#await"
89
89
end
90
- sched . await ( self )
90
+ # Promise.resolve wrap a value or flattens promise-like object and its thenable chain
91
+ promise = JS . global [ :Promise ] . resolve ( self )
92
+ sched . await ( promise )
91
93
end
92
94
end
93
95
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def test_await_promise_chained
18
18
assert_equal 43 , promise . await . to_i
19
19
end
20
20
21
- # def test_await_non_promise
22
- # assert_equal 42, JS.eval("return 42").await.to_i
23
- # end
21
+ def test_await_non_promise
22
+ assert_equal 42 , JS . eval ( "return 42" ) . await . to_i
23
+ end
24
24
end
You can’t perform that action at this time.
0 commit comments