import { Assertion } from "./Assertion"; /** * Encapsulates assertion methods applicable to Promises * * @param T the type of the value of the promise * @param I type to track the current inverted state */ export declare class PromiseAssertion extends Assertion> { readonly not: PromiseAssertion; constructor(actual: Promise); /** * Check if a promise is resolved. If `.not` is prepended, the resulting * promise will contain the error. * * **Important:** Remember to return or `await` for this assertion to not * leave the promise asynchronous to the test * * @example * ``` * await expect(successfulAsyncRequest()).toBeResolved(); * ``` * * @returns a promise with the resolved value (or an error if `.not` was * prepended) */ toBeResolved(): Promise; /** * Check if a promise is resolved exactly (deep strict equally) with the * passed value. If `.not` is prepended, it will check if the promise was * resolved with anything but the passed value. * * **Important:** Remember to return or `await` for this assertion to not * leave the assertion asynchronous in the test * * @example * ``` * await expect(requestAsyncMagicValue()).toBeResolvedWith(64); * ``` * * @param expected the expected value to be resolved by the promise * @returns a promise with the resolved value */ toBeResolvedWith(expected: T): Promise; /** * Check if the promise was rejected. If `.not` is prepended, the resulting * promise will contain the value. * * **Important:** Remember to return or `await` for this assertion to not * leave the promise asynchronous to the test * * @example * ``` * await expect(failingAsyncRequest()).toBeRejected(); * ``` * * @returns a promise with the caught error (or the value if `.not` is * prepended) */ toBeRejected(): Promise; /** * Check if a promise is rejected exactly (deep strict equally) with the * passed error. If `.not` is prepended, it will check if the promise was * rejected with anything but the passed error. * * **Important:** Remember to return or `await` for this assertion to not * leave the promise asynchronous to the test * * @example * ``` * await expect(failingAsyncRequest()).toBeRejectedWith(new Error("404")); * ``` * * @typeParam E the type of the rejected value * @param expected the expected error to be rejected by the promise * @returns a promise with the caught error */ toBeRejectedWith(expected: E): Promise; }