ibm-js / requirejs-dplugins

AMD plugins for RequireJS
http://ibm-js.github.io/requirejs-dplugins/
Other
6 stars 9 forks source link

Add a plugin to shim the ES6 Promise implementation #17

Closed clmath closed 9 years ago

clmath commented 9 years ago

I am not sure how to test this plugin as the returned value will vary according to the tested platform.

wkeese commented 9 years ago

I am not sure how to test this plugin as the returned value will vary according to the tested platform.

But, the returned value always has the same API, right? It's not your job to test that the Promise shim (or the native implementation) work correctly, but you could have a simple smoke test unit test like:

promiseAssertWorks: function () {
    var d = this.async(1000);
    new Promise(function (resolve) {
        setTimeout(resolve, 50);
    }).then(function () {
        d.resolve(true);
    });
},

The code for the plugin itself looks fine to me.

clmath commented 9 years ago

I added the unit test and change the local require to the global require.

clmath commented 9 years ago

Merged in 89e7655a964b0f54e5c75b8cbe4ef4c2339a8e58