tests: solved meteor-promise - sanity

This commit is contained in:
Gabriel Grubba
2023-01-16 20:29:00 -03:00
parent 74e029d164
commit 4582ea6eb4

View File

@@ -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) {