Add tests for promise support
Add promise support (close #319, close #1036)