test(api): add test for promise resolve when the callback throws