55 lines
2.4 KiB
Plaintext
55 lines
2.4 KiB
Plaintext
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: Cannot call a constructor without |new|.
|
|
|
|
Promise constructor
|
|
|
|
PASS Promise.length is 1
|
|
PASS new Promise() threw exception TypeError: Promise constructor takes a function argument.
|
|
PASS Promise() threw exception TypeError: Cannot call a constructor without |new|.
|
|
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: Cannot call a constructor without |new|.
|
|
PASS Promise('hello') threw exception TypeError: Cannot call a constructor without |new|.
|
|
PASS Promise([]) threw exception TypeError: Cannot call a constructor without |new|.
|
|
PASS Promise({}) threw exception TypeError: Cannot call a constructor without |new|.
|
|
PASS Promise(null) threw exception TypeError: Cannot call a constructor without |new|.
|
|
PASS Promise(undefined) threw exception TypeError: Cannot call a constructor without |new|.
|
|
|
|
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
|
|
|