Add tests from #52412

This commit is contained in:
Alex Dima
2018-07-02 12:05:20 +02:00
parent e719f08cea
commit 9febb2897f
+26 -3
View File
@@ -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<number>(new Promise<number>(function (c, e) { c(1); }));
Promise.all([p1]);
});
test('2. Uncaught TypeError: this._state.then is not a function', () => {
let p1 = winjs.Promise.wrap<number>(new Promise<number>(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);
});
});