node-bluebird/test/mocha/no_conflict.js

22 lines
750 B
JavaScript
Raw Normal View History

2023-02-17 11:33:40 +08:00
var assert = require("assert");
var testUtils = require("./helpers/util.js");
describe("Promise.noConflict", function() {
specify("should work", function() {
var glob = typeof window !== "undefined" ? window : global;
var bluebird = Promise.noConflict();
assert(bluebird !== Promise);
glob.Promise = null;
assert.strictEqual(bluebird, bluebird.noConflict());
try {
delete glob.Promise;
assert.strictEqual(bluebird, bluebird.noConflict());
} catch (e) {
assert.strictEqual(bluebird, bluebird.noConflict());
}
glob.Promise = bluebird;
assert.strictEqual(bluebird, Promise.noConflict());
glob.Promise = bluebird;
})
});