There was an error while loading. Please reload this page.
1 parent ca47876 commit f5fb111Copy full SHA for f5fb111
promise_test.go
@@ -104,3 +104,24 @@ func TestPromiseRejected(t *testing.T) {
104
t.Fatalf("expected call to onRejected, got none")
105
}
106
107
+
108
+func TestPromiseThenPanic(t *testing.T) {
109
+t.Parallel()
110
111
+iso, _ := v8go.NewIsolate()
112
+ctx, _ := v8go.NewContext(iso)
113
+res, _ := v8go.NewPromiseResolver(ctx)
114
+prom := res.GetPromise()
115
116
+t.Run("no callbacks", func(t *testing.T) {
117
+defer func() { recover() }()
118
+prom.Then()
119
+t.Errorf("expected a panic")
120
+})
121
+t.Run("3 callbacks", func(t *testing.T) {
122
123
+fn := func(_ *v8go.FunctionCallbackInfo) *v8go.Value { return nil }
124
+prom.Then(fn, fn, fn)
125
126
127
+}
0 commit comments