Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

✨ add additional error message is the type passed in is null or undef…#1047

Merged
michenly merged 1 commit intomasterfrom
check-type
Sep 27, 2019
Merged

✨ add additional error message is the type passed in is null or undef…#1047
michenly merged 1 commit intomasterfrom
check-type

Conversation

@michenly
Copy link
Contributor

@michenly michenly commented Sep 25, 2019

…ined.

Description

Fixes #981

When PayoutLayout is undeifned
Before:
64643947-90156600-d3df-11e9-8f71-605c1e82d021

After:
Screen Shot 2019-09-25 at 3 35 52 PM

Type of change

  • Patch: Bug/ Documentation fix (non-breaking change which fixes an issue or adds documentation)
  • Minor: New feature (non-breaking change which adds functionality)
  • Major: Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have added a changelog entry, prefixed by the type of change noted above

@michenly michenly force-pushed the check-type branch 2 times, most recently from 2b7ae40 to 2b1215e Compare September 25, 2019 21:03
@michenly michenly self-assigned this Sep 25, 2019
Copy link
Contributor

@cartogram cartogram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

matcherHint(`.${expectation}`, undefined, undefined, {isNot}),
`${receivedColor(
'expected',
)} value must be a string or a valid ReactComponent.`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
)} value must be a string or a valid ReactComponent.`,
)} value must be a string or a valid React component.`,


### Changed

- Both `toContainReactComponent` and `toContainReactComponentTimes` matcher will now throw error if expected value is `null` or `undefined` ([#1047](https://github.com/Shopify/quilt/pull/1047))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Both `toContainReactComponent` and `toContainReactComponentTimes` matcher will now throw error if expected value is `null` or `undefined` ([#1047](https://github.com/Shopify/quilt/pull/1047))
- Both `toContainReactComponent` and `toContainReactComponentTimes` matcher will now throw a more useful error if the expected value is `null` or `undefined` ([#1047](https://github.com/Shopify/quilt/pull/1047))

type: unknown,
{expectation, isNot}: {expectation: string; isNot: boolean},
) {
if (type == null || type === undefined) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type == null is all you need here

@michenly michenly force-pushed the check-type branch 5 times, most recently from c00451f to 69cc0fc Compare September 26, 2019 21:01
@michenly michenly merged commit cfd7a76 into master Sep 27, 2019
@michenly michenly deleted the check-type branch September 27, 2019 15:25
@michenly michenly temporarily deployed to production September 27, 2019 18:54 Inactive
@marutypes marutypes temporarily deployed to gem October 23, 2019 21:05 Inactive
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

undefined 'displayName' when asserting a component's existence.

4 participants