Skip to content

Instantly share code, notes, and snippets.

@andrewfinnell
Created September 29, 2016 18:30
Show Gist options
  • Save andrewfinnell/55f65ce2f2e9d46683a8e944a9933916 to your computer and use it in GitHub Desktop.
Save andrewfinnell/55f65ce2f2e9d46683a8e944a9933916 to your computer and use it in GitHub Desktop.
import QUnit from "qunitjs";
QUnit.module("Async Bluebird Testsuite");
/* jshint ignore:start */
QUnit.test("Test async functions", async function (assert) {
//var done = assert.async();
function doSomethingAsync() {
// Imagine this being a XHR request or database call instead.
return new Promise(function (resolve, reject) {
resolve("success");
});
}
async function getResult() {
return await doSomethingAsync ();
}
var result = await getResult();
assert.equal(result, "success", "Async result = '" + result + "'");
});
/* jshint ignore:end */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment