Created
September 29, 2016 18:30
-
-
Save andrewfinnell/55f65ce2f2e9d46683a8e944a9933916 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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