-
Notifications
You must be signed in to change notification settings - Fork 154
Test CreateNewProjectWizard components #361
Conversation
Codecov Report
@@ Coverage Diff @@
## master #361 +/- ##
===========================================
+ Coverage 37.54% 49.65% +12.11%
===========================================
Files 158 158
Lines 3540 3351 -189
Branches 449 458 +9
===========================================
+ Hits 1329 1664 +335
+ Misses 1928 1446 -482
+ Partials 283 241 -42
|
expect(instance.verifyProjectNameUniqueness).not.toHaveBeenCalled(); | ||
}); | ||
|
||
it('should set foucs', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: focus
|
||
beforeEach(() => { | ||
wrapper = shallowRenderBuildPane(newProject); | ||
instance = wrapper.instance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instance = wrapper.instance(); | |
instance = wrapper.instance(); | |
// mock console errors so they don't output while running the test | |
jest.spyOn(console, 'error') | |
console.error.mockImplementation(() => {}) | |
}) | |
afterEach(() => { | |
console.error.mockRestore() | |
}) |
This prevents the error from being output while running the missing project prop test (which is confusing output IMO). From jestjs/jest#5267 (comment).
Screenshot of the error being logged:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems very comprehensive and LGTM 👍 Just had the suggestion for no console error output.
I'm all for __tests__
folder if it improves organization. Since it's ultimately grouped under CreateNewProjectWizard I think it's fine.
I wouldn't be able to answer your other question but I think we could gather these questions and file an issue to see if the community knows a better way.
* WIP: Added tests * WIP: ProjectType undefined not throwing in test * fixed flow * added tests * reverted to children render props * Merge branch 'master' into test-create-new-project-wiz * Fixed linting & replaced snapshot with simple smoke tests * addressed review comments
* add analytics tags * Update AddDependencySearchProvider.js * #352 Disable actions that require an internet connection (#368) * Online check component added * add reducer & action for online check component. also included in App.js * removed sidebar functionality when offline * removed depedency functionality when offline * removed functionality from create new project wizard when offline * fixed tests to align with disabled pattern * add infoBanner to Z-indexes for future usage. * removed random {' '}, changed IS_ONLINE_CHECK to SET_ONLINE_STATUS * pull request requested changes missed one file. * updated infobar to be fixed header. * flow fix * remove random whitespace * Pull request changes remove state type, move styled components to before redux part, change background color of infobar to be transparent. * enable menu items based on isOnline * Setup ESlint rules for Jest (#366) * WIP: Added eslint-jest & fixed issues (except snapshots) * reduced snapshot size to meet max 100 lines * fixed snapshot * changed comment to a note about noPadding prop * updated snapshot * Test ProjectConfigurationModal component (#360) * WIP: Added render test * WIP: Added tests * fixed flow * added focus test * Merge branch 'master' into test-project-configuration-modal * fixed linting warnings * removed typing as no flow used in test files * Test CreateNewProjectWizard components (#361) * WIP: Added tests * WIP: ProjectType undefined not throwing in test * fixed flow * added tests * reverted to children render props * Merge branch 'master' into test-create-new-project-wiz * Fixed linting & replaced snapshot with simple smoke tests * addressed review comments * Test DependencyManagementPane component (#363) * moved related components to DependencyManagementPane * added tests * fixed flow * added a constant instead of Date.now() * updated snapshot * removed white-spaces * removed verbose * fixed linting & mocked AlgoliaLogo * move related component files & moved tests to __tests__ folder * Add script for test:dev * Fix spaces and update lint-staged (#369) * Switch to advanced config to silence validation warning * Fix spacing issues * chore: fix merge changes
Related Issue:
#309
Summary:
This is a larger PR and adds the tests for the following components from
src\components\CreateNewProjectWizard
scramble
method is untested)Todos
Write tests for these components
Discussion
updateProject...
method inMainPane.js
? The tests are easy to understand but if there would be a refactor of the component it's some work to rename/modify these tests. Is there a better way of testing prop methods?__tests__
folder here? I think the test files are adding some noise around the components inCreateNewProjectWizard
folder. There are around 10 components and 10 test files. I think it's OK to keep both in the same folder if there are just one or two components. But it's probably also OK to keep all in the same folder. If we'd change to tests folder just imports need to be modified by one additional relative path../
.Notes
Package.json
update ofenzyme
forrenderProp
support (see MainPane.test.js)/* eslint-disable flowtype/require-valid-file-annotation */
is not needed anymore. It was annoying to copy that line to each new test file. Please let me know if it's OK to add the override to.eslintrc.js
file.