storybook-addon-specifications
storybook-addon-specifications copied to clipboard
Promise asynchronous interface
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.