blob: 5d1db390f5b0c8c599c2e22847988e00e4ded032 [file] [log] [blame]
Promises - Test basic types / exceptions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Promises
aPromise = new Promise(...)
PASS aPromise is an instance of Promise
PASS String(aPromise) is '[object Promise]'
PASS aPromise.then is defined.
PASS aPromise.then is an instance of Function
PASS aPromise.then.length is 2
PASS aPromise.catch is defined.
PASS aPromise.catch is an instance of Function
PASS aPromise.catch.length is 1
PASS aPromise.finally is an instance of Function
PASS aPromise.finally.length is 1
aPromise2 = Promise(...)
PASS Promise(function(resolve, reject) { resolve(1); }) threw exception TypeError: calling Promise constructor without new is invalid.
Promise constructor
PASS Promise.length is 1
PASS new Promise() threw exception TypeError: Promise constructor takes a function argument.
PASS Promise() threw exception TypeError: calling Promise constructor without new is invalid.
PASS new Promise(1) threw exception TypeError: Promise constructor takes a function argument.
PASS new Promise('hello') threw exception TypeError: Promise constructor takes a function argument.
PASS new Promise([]) threw exception TypeError: Promise constructor takes a function argument.
PASS new Promise({}) threw exception TypeError: Promise constructor takes a function argument.
PASS new Promise(null) threw exception TypeError: Promise constructor takes a function argument.
PASS new Promise(undefined) threw exception TypeError: Promise constructor takes a function argument.
PASS Promise(1) threw exception TypeError: calling Promise constructor without new is invalid.
PASS Promise('hello') threw exception TypeError: calling Promise constructor without new is invalid.
PASS Promise([]) threw exception TypeError: calling Promise constructor without new is invalid.
PASS Promise({}) threw exception TypeError: calling Promise constructor without new is invalid.
PASS Promise(null) threw exception TypeError: calling Promise constructor without new is invalid.
PASS Promise(undefined) threw exception TypeError: calling Promise constructor without new is invalid.
Promise statics
PASS Promise.resolve is an instance of Function
PASS Promise.resolve.length is 1
PASS Promise.resolve(1) did not throw exception.
PASS Promise.reject is an instance of Function
PASS Promise.reject.length is 1
PASS Promise.reject(1) did not throw exception.
PASS Promise.resolve(1) is an instance of Promise
PASS Promise.reject(1) is an instance of Promise
PASS successfullyParsed is true
TEST COMPLETE