Every body knows that writing unit test is very important during programming.
However, it is not an easy job, especially when it comes to asynchronous code.

Initially, callback has to be used to test asynchronous code:

This kind of test could easily turned out to be a [callback hell][ch] when the logic become complex.
Thank god, with the advent of promise, testing asynchronous code is not that much depressing now.

Actually manually calling done is not necessary any more in newer version of mocha, as mocha takes care of promise itself pretty well.
So the above code can be written as:

Now this looks good.
However, we won’t be satisfied with this, will we?
Take a look at how this code could be further improved with async/await.

In the above snippet, we are taking advantage of of one lovely feature of Async functions:

Async functions always return a promise, no matter whether or not await is invoked.
The promise, returned by async function, would resolve with whatever the async function returns, or rejects with whatever the async function throws.
With the async/await, testing asynchronous code is nearly identical to testing synchronous code.
Cheer!!!

##### Caveat

Every thing comes at a price.
Although it is very trendy now, we still need a transpiler like bable to use async/await.
What a pity.
[ch]:http://callbackhell.com/