From 9febb2897fa14772fbcd05ea04956f211c765c6c Mon Sep 17 00:00:00 2001 From: Alex Dima Date: Mon, 2 Jul 2018 12:05:20 +0200 Subject: [PATCH] Add tests from #52412 --- src/vs/base/test/common/winjs.promise.test.ts | 29 +++++++++++++++++-- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/src/vs/base/test/common/winjs.promise.test.ts b/src/vs/base/test/common/winjs.promise.test.ts index 81813f3c8cd..a9b3038b457 100644 --- a/src/vs/base/test/common/winjs.promise.test.ts +++ b/src/vs/base/test/common/winjs.promise.test.ts @@ -5,13 +5,13 @@ 'use strict'; import * as assert from 'assert'; -import * as WinJS from 'vs/base/common/winjs.base'; +import * as winjs from 'vs/base/common/winjs.base'; suite('WinJS and ES6 Promises', function () { test('Promise.resolve', function () { let resolveTPromise; - const tPromise = new WinJS.Promise(function (c, e, p) { + const tPromise = new winjs.Promise(function (c, e, p) { resolveTPromise = c; }); @@ -28,7 +28,7 @@ suite('WinJS and ES6 Promises', function () { test('new Promise', function () { let resolveTPromise; - const tPromise = new WinJS.Promise(function (c, e, p) { + const tPromise = new winjs.Promise(function (c, e, p) { resolveTPromise = c; }); @@ -44,4 +44,27 @@ suite('WinJS and ES6 Promises', function () { return done; }); + + test('1. Uncaught TypeError: this._state.then is not a function', () => { + let p1 = winjs.Promise.wrap(new Promise(function (c, e) { c(1); })); + Promise.all([p1]); + }); + + test('2. Uncaught TypeError: this._state.then is not a function', () => { + let p1 = winjs.Promise.wrap(new Promise(function (c, e) { c(1); })); + let thenFunc = p1.then.bind(p1); + setTimeout(() => { + thenFunc(() => { }); + }, 0); + }); + + test('3. Uncaught TypeError: this._state.then is not a function', () => { + let c; + let p1 = new winjs.Promise(function (_c, e) { c = _c; }); + let thenFunc = p1.then.bind(p1); + setTimeout(() => { + c(1); + thenFunc(() => { }); + }, 0); + }); });