1 | declare module 'ember-testing/lib/test/promise' {
|
2 |
|
3 | import { RSVP } from '@ember/-internals/runtime';
|
4 | type Executor<T> = (
|
5 | resolve: (value?: T | PromiseLike<T>) => void,
|
6 | reject: (reason?: any) => void
|
7 | ) => void;
|
8 | type OnFulfilled<T, TResult = T> = (value: T) => TResult | PromiseLike<TResult>;
|
9 | export default class TestPromise<T> extends RSVP.Promise<T> {
|
10 | constructor(executor: Executor<T>, label?: string);
|
11 | then<TResult1 = T, TResult2 = never>(
|
12 | onFulfilled?: OnFulfilled<T, TResult1> | null,
|
13 | onRejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null,
|
14 | label?: string
|
15 | ): RSVP.Promise<TResult1 | TResult2>;
|
16 | }
|
17 | /**
|
18 | This returns a thenable tailored for testing. It catches failed
|
19 | `onSuccess` callbacks and invokes the `Ember.Test.adapter.exception`
|
20 | callback in the last chained then.
|
21 |
|
22 | This method should be returned by async helpers such as `wait`.
|
23 |
|
24 | @public
|
25 | @for Ember.Test
|
26 | @method promise
|
27 | @param {Function} resolver The function used to resolve the promise.
|
28 | @param {String} label An optional string for identifying the promise.
|
29 | */
|
30 | export function promise<T>(resolver: Executor<T>, label?: string): TestPromise<T>;
|
31 | |
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 | export function resolve(result: unknown, label?: string): RSVP.default.Promise<unknown>;
|
43 | export function getLastPromise(): TestPromise<unknown> | null;
|
44 | export {};
|
45 | }
|