supasympa
8/11/2017 - 10:14 PM

Simple Mocha async/await example

Simple Mocha async/await example

const chai = require('chai');
const expect = chai.expect;

describe('An async await test', () => {
  it(`Should work.`, async () => {
    const HELLO_WORLD = "Hello World!";
    const run = Promise.resolve(HELLO_WORLD);
    const message = await run;

    expect(message).to.equal(HELLO_WORLD);
  });
});