Skip to content
This repository was archived by the owner on Jun 17, 2019. It is now read-only.

Commit 9946038

Browse files
author
Josef Blake
committed
add defaultProps.await
1 parent b9a45af commit 9946038

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

__tests__/Async.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,22 @@ afterEach(() => {
1919
ReactDOM.unmountComponentAtNode(mountNode);
2020
});
2121

22+
test("renders", () => {
23+
expect(() => mount(<Async />)).not.toThrowError();
24+
});
25+
2226
test("throws error if not passed a promise", () => {
2327
const onError = jest.fn();
2428

25-
[1, {}, [], undefined, null].forEach(notPromise => {
29+
[1, {}, [], null].forEach(notPromise => {
2630
mount(
2731
<ErrorBoundary onError={onError}>
2832
<Async await={notPromise} />
2933
</ErrorBoundary>
3034
);
3135
});
3236

33-
expect(onError).toHaveBeenCalledTimes(5);
37+
expect(onError).toHaveBeenCalledTimes(4);
3438
});
3539

3640
test("resolves promise", async () => {

src/Async.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class Async extends React.Component {
7373
}
7474

7575
Async.defaultProps = {
76+
await: Promise.resolve(),
7677
children: () => null
7778
};
7879

0 commit comments

Comments
 (0)