mthuret / storybook-addon-specifications

:book: Write tests next to your stories and display their results inside storybook interface

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Promise asynchronous interface

michaelgallaghertw opened this issue · comments

Both Jest and Mocha offer the same Promise-based asynchronous interface:

https://jestjs.io/docs/en/tutorial-async

// The assertion for a promise must be returned.
it('works with promises', () => {
  expect.assertions(1);
  return user.getUserName(4).then(data => expect(data).toEqual('Mark'));
});

Alternative syntax based on the same returned promise interface:
https://jestjs.io/docs/en/tutorial-async#resolves
https://jestjs.io/docs/en/tutorial-async#async-await

Currently storybook-addon-specifications accepts the done async interface, but not the Promise-based one.

I'll open a PR in a minute with this functionality implemented.