Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/test connect #1781

Merged
merged 14 commits into from Jul 31, 2021
Merged

Conversation

myNameIsDu
Copy link
Contributor

Refactor test connect

link: #1737

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jul 29, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c9a5b8f:

Sandbox Source
Vanilla Configuration
Vanilla Typescript Configuration

@netlify
Copy link

netlify bot commented Jul 29, 2021

✔️ Deploy Preview for react-redux-docs ready!

🔨 Explore the source changes: c9a5b8f

🔍 Inspect the deploy log: https://app.netlify.com/sites/react-redux-docs/deploys/61059528d5c74e0007adda45

😎 Browse the preview: https://deploy-preview-1781--react-redux-docs.netlify.app

@markerikson markerikson marked this pull request as draft July 29, 2021 04:35
@markerikson
Copy link
Contributor

Looks okay so far. Lemme know when you have the rest of the logic uncommented and converted!

@myNameIsDu
Copy link
Contributor Author

@markerikson Because it's a big file, I think it's a good idea for you to check it earlier, and comment out the test cases that are not converted, because they don't pass the check and all of them are temporarily commented out until I convert them little by little, Finally, thank you for giving me valuable writing instructions

@myNameIsDu
Copy link
Contributor Author

Looks okay so far. Lemme know when you have the rest of the logic uncommented and converted!

ok, thanks

@myNameIsDu myNameIsDu marked this pull request as ready for review July 29, 2021 17:15
@myNameIsDu myNameIsDu marked this pull request as draft July 29, 2021 17:15
describe: Performance optimizations and bail-outs
it:
   should not attempt to set state when dispatching in componentWillUnmount
   should not attempt to set state after unmounting
   should allow to clean up child state in parent componentWillUnmount
describe:
	Wrapped component and HOC handling
	Store subscriptions and nesting
add a package: @types/create-react-class
@myNameIsDu
Copy link
Contributor Author

@markerikson I don't know why it uses npm instead and causes an error that triggers yarn, strange

@markerikson
Copy link
Contributor

@myNameIsDu looks like commit 8bbc934 added a package-lock.json file. Delete that and I suspect CSB should be happier.

@myNameIsDu
Copy link
Contributor Author

@myNameIsDu looks like commit 8bbc934 added a package-lock.json file. Delete that and I suspect CSB should be happier.

Yes, then the default order for the CSB is to check the lock file of npm => yarn 😆 It's an interesting thing, but I don't know much about it

@myNameIsDu
Copy link
Contributor Author

@markerikson I found some old skip cases, should I delete them?

@myNameIsDu myNameIsDu marked this pull request as ready for review July 31, 2021 16:33
Copy link
Contributor

@markerikson markerikson left a comment

Choose a reason for hiding this comment

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

Looks great! My only comments are a question about what TS errors we're ignoring in a few places, and that the getWrappedInstance test can be deleted.

@@ -2020,6 +2382,7 @@ describe('React', () => {

rtl.render(
<ProviderMock store={store}>
{/*// @ts-ignore */}
Copy link
Contributor

Choose a reason for hiding this comment

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

just out of curiosity, what issues are we ignoring in this area of the code?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, I was going to talk to you about that, The wrapper returned by connect does not receive the context type

image

I think this is an advanced use of connectAdvanced, or we need to tweak the original type

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm. Yeah, it's entirely possible that's a bug in the types.

Let's leave the ignore in there for now, and maybe leave a // TODO comment saying to re-investigate it later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a good idea. I think I can fix it after this PR #1771 is done

spy.mockRestore()
})

// it.skip('should throw when trying to access the wrapped instance if withRef is not specified', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

✋ Yeah, this is dead - getWrappedInstance() went away in version 6, and I guess we never removed this test. Delete it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image
This descript is also all skip, I can also delete it directly?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, let's delete that one too

@markerikson
Copy link
Contributor

Awright, let's get this in.

Thank you so much for working on this!

@markerikson markerikson merged commit dffd1f2 into reduxjs:master Jul 31, 2021
@myNameIsDu myNameIsDu deleted the refactor/test-connect branch August 5, 2021 02:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants