diff options
Diffstat (limited to 'test/promises.tests.js')
| -rw-r--r-- | test/promises.tests.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/promises.tests.js b/test/promises.tests.js index 3dd24be..f54245b 100644 --- a/test/promises.tests.js +++ b/test/promises.tests.js @@ -46,3 +46,54 @@ test("try", { ); } }); + +test("props", { + "props({}) resolve to {}": function() { + return promises.props({}).then(function(result) { + assert.deepStrictEqual(result, {}); + }); + }, + + "when object has promise values then props returns with all values resolved": function() { + return promises.props({ + a: promises.resolve(1), + b: promises.resolve(2), + c: promises.resolve(3) + }).then(function(result) { + assert.deepStrictEqual(result, { + a: 1, + b: 2, + c: 3 + }); + }); + }, + + "when object has non-promise values then props returns with same values": function() { + return promises.props({ + a: 1, + b: 2, + c: 3 + }).then(function(result) { + assert.deepStrictEqual(result, { + a: 1, + b: 2, + c: 3 + }); + }); + }, + + "props(...).also(...) can be used to add props": function() { + return promises.props({ + a: promises.resolve(1) + }).also(function(result) { + return { + b: result.a + 1 + }; + }).then(function(result) { + assert.deepStrictEqual(result, { + a: 1, + b: 2 + }); + }); + } +}); |
