mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
tests: solved meteor-promise - sanity
This commit is contained in:
@@ -1,18 +1,24 @@
|
||||
Tinytest.addAsync("meteor-promise - sanity", function (test, done) {
|
||||
var expectedError = new Error("expected");
|
||||
Promise.resolve("working").then(function (result) {
|
||||
test.equal(result, "working");
|
||||
throw expectedError;
|
||||
}).catch(function (error) {
|
||||
test.equal(error, expectedError);
|
||||
if (Meteor.isServer) {
|
||||
var Fiber = require("fibers");
|
||||
// Make sure the Promise polyfill runs callbacks in a Fiber.
|
||||
test.instanceOf(Fiber.current, Fiber);
|
||||
}
|
||||
}).then(done, function (error) {
|
||||
test.exception(error);
|
||||
});
|
||||
Promise.resolve("working")
|
||||
.then(function (result) {
|
||||
test.equal(result, "working");
|
||||
throw expectedError;
|
||||
})
|
||||
.catch(function (error) {
|
||||
test.equal(error, expectedError);
|
||||
if (Meteor.isServer) {
|
||||
// TODO[FIBERS]: Remove this in 3.0
|
||||
if (Meteor._isFibersEnabled) {
|
||||
var Fiber = require("fibers");
|
||||
// Make sure the Promise polyfill runs callbacks in a Fiber.
|
||||
test.instanceOf(Fiber.current, Fiber);
|
||||
}
|
||||
}
|
||||
})
|
||||
.then(done, function (error) {
|
||||
test.exception(error);
|
||||
});
|
||||
});
|
||||
|
||||
Tinytest.addAsync("meteor-promise - finally", function (test, done) {
|
||||
|
||||
Reference in New Issue
Block a user