Changing `promise.then()` & `promise.resolve()` to use a generic test test in lieu of the `instanceof` operator