Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jablko committed Oct 9, 2019
1 parent 4e2f467 commit 0b9b4e6
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/baselines/reference/promiseType.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));

declare const x2: Promise<number> | string;
Promise.resolve(x2);


//// [promiseType.js]
Expand Down Expand Up @@ -440,3 +443,4 @@ const pc6 = p.then(() => Promise.reject("1"), () => { });
const pc7 = p.then(() => Promise.reject("1"), () => { throw 1; });
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
Promise.resolve(x2);
10 changes: 10 additions & 0 deletions tests/baselines/reference/promiseType.symbols
Original file line number Diff line number Diff line change
Expand Up @@ -1089,3 +1089,13 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>reject : Symbol(PromiseConstructor.reject, Decl(lib.es2015.promise.d.ts, --, --))

declare const x2: Promise<number> | string;
>x2 : Symbol(x2, Decl(promiseType.ts, 219, 13))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))

Promise.resolve(x2);
>Promise.resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --))
>resolve : Symbol(PromiseConstructor.resolve, Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --))
>x2 : Symbol(x2, Decl(promiseType.ts, 219, 13))

10 changes: 10 additions & 0 deletions tests/baselines/reference/promiseType.types
Original file line number Diff line number Diff line change
Expand Up @@ -1583,3 +1583,13 @@ const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));
>reject : <T = never>(reason?: any) => Promise<T>
>1 : 1

declare const x2: Promise<number> | string;
>x2 : string | Promise<number>

Promise.resolve(x2);
>Promise.resolve(x2) : Promise<string | number>
>Promise.resolve : { <T>(value: T): Promise<T extends PromiseLike<infer U> ? U : T>; (): Promise<void>; }
>Promise : PromiseConstructor
>resolve : { <T>(value: T): Promise<T extends PromiseLike<infer U> ? U : T>; (): Promise<void>; }
>x2 : string | Promise<number>

3 changes: 3 additions & 0 deletions tests/cases/compiler/promiseType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,3 +217,6 @@ const pc6 = p.then(() => Promise.reject("1"), () => {});
const pc7 = p.then(() => Promise.reject("1"), () => {throw 1});
const pc8 = p.then(() => Promise.reject("1"), () => Promise.resolve(1));
const pc9 = p.then(() => Promise.reject("1"), () => Promise.reject(1));

declare const x2: Promise<number> | string;
Promise.resolve(x2);

0 comments on commit 0b9b4e6

Please sign in to comment.