Skip to content

Instantly share code, notes, and snippets.

@timjacobi
Last active May 18, 2018 10:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timjacobi/f68f0ea088a44b2e6b8669bd1e71ab73 to your computer and use it in GitHub Desktop.
Save timjacobi/f68f0ea088a44b2e6b8669bd1e71ab73 to your computer and use it in GitHub Desktop.
Promise Kata
// Implementation
class Promise {}
// Test Code
const adapter = {
deferred() {
const pending = {};
pending.promise = new Promise((resolver, reject) => {
pending.resolve = resolver;
pending.reject = reject;
});
return pending;
},
resolved: val => Promise.resolve(val),
rejected: val => Promise.reject(val)
};
require("promises-aplus-tests")(adapter, { reporter: "dot" }, console.error.bind(console));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment