Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/__tests__/__snapshots__/withJob.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,13 @@ exports[`withJob() rendering should set the "result" immediately if the work doe
</ResultRenderer>
</WithJob(ResultRenderer)>
`;

exports[`withJob() rendering should set the "result" immediately if the work return null 1`] = `
<WithJob(ResultRenderer)>
<ResultRenderer
jobResult={null}
>
<div />
</ResultRenderer>
</WithJob(ResultRenderer)>
`;
7 changes: 7 additions & 0 deletions src/__tests__/withJob.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ fdescribe('withJob()', () => {
expect(mount(<ResultRendererWithJob />)).toMatchSnapshot()
})

it('should set the "result" immediately if the work return null', () => {
const ResultRendererWithJob = withJob({ work: () => null })(
ResultRenderer,
)
expect(mount(<ResultRendererWithJob />)).toMatchSnapshot()
})

it('should provide the props to the work function', () => {
const expected = { foo: 'bar', baz: 'qux' }
let actual
Expand Down
2 changes: 1 addition & 1 deletion src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ export function getDisplayName(WrappedComponent) {
}

export const isPromise = x =>
typeof x === 'object' && typeof x.then === 'function'
x && typeof x === 'object' && typeof x.then === 'function'

export const propsWithoutInternal = props => {
// eslint-disable-next-line no-unused-vars
Expand Down