I found some copy/paste remnants from toHaveProp in toHaveState, which are causing toHaveState failures to print toHaveProp messaging. This change fixes those messages and also cleans up the messaging for toHaveState and toHaveProp to be more clear and consistent.
Also the current "Expected props/state" messaging offers little value and is misleading for the negated variation, when no expected value is given; so I removed it.
expect(wrapper).toHaveState('error')
Current Messaging
Expected <MyComponent> to have any value for the prop "error"
Actual props: error: undefined
Expected props: error: undefined
Updated Messaging
Expected the state for <MyComponent> to contain a value for key "error", but it did not.
Actual state: error: undefined
expect(wrapper).not.toHaveState('error')
Current Messaging
Expected <MyComponent> not to receive the prop "error"
Actual props: error: 'some-error'
Expected props: error: undefined
Updated Messaging:
Expected the state for <MyComponent> to not contain a value for key "error", but it did.
Actual state: error: 'some-error'
I found some copy/paste remnants from
toHaveProp
intoHaveState
, which are causingtoHaveState
failures to printtoHaveProp
messaging. This change fixes those messages and also cleans up the messaging fortoHaveState
andtoHaveProp
to be more clear and consistent.Also the current "Expected props/state" messaging offers little value and is misleading for the negated variation, when no expected value is given; so I removed it.
expect(wrapper).toHaveState('error')
Current Messaging
Updated Messaging
expect(wrapper).not.toHaveState('error')
Current Messaging
Updated Messaging: