From a3a365d9297b19b4c94c55a85804f7879da75e62 Mon Sep 17 00:00:00 2001 From: Stephen Ierodiaconou Date: Wed, 23 Mar 2016 17:14:10 +0000 Subject: [PATCH] Update Q tests to include fact deferred can be resolved with a value or promise As per the Q docs "Note that a deferred can be resolved with a value or a promise. " --- q/Q-tests.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/q/Q-tests.ts b/q/Q-tests.ts index 025a92358..ab613f8aa 100644 --- a/q/Q-tests.ts +++ b/q/Q-tests.ts @@ -16,6 +16,10 @@ Q.when(delay(1000), function (val: void) { return; }); +// Note from Q documentation: a deferred can be resolved with a value or a promise. +var otherPromise = Q.defer().promise; +Q.defer().resolve(otherPromise); + Q.timeout(Q(new Date()), 1000, "My dates never arrived. :(").then(d => d.toJSON()); Q.delay(Q(8), 1000).then(x => x.toExponential());