-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
[Fixes] Code Coverage: Create tests for src/index.ts #296
[Fixes] Code Coverage: Create tests for src/index.ts #296
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #296 +/- ##
===========================================
+ Coverage 40.22% 46.20% +5.98%
===========================================
Files 45 45
Lines 711 699 -12
Branches 149 149
===========================================
+ Hits 286 323 +37
+ Misses 410 364 -46
+ Partials 15 12 -3
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
Please make sure the issue is assigned to you before making the pull request. We may close PRs for which there is no assigned issue. |
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.
You will need to get to 100% coverage for the review to be done.
I am sorry sir , I'll keep that in mind next time |
the thing doesn't work like this it shows the percent of whole code coverage if it is a + then it is okay |
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.
explain the test like which things they are doing and what is the expected result for the same
@palisadoes @yasharth291 sir I am very confused currently, #278 Issue is asking to test the src/state/index.ts file which contains the following code (there is only 1 line in the file) export * as actionCreators from './action-creators/index'; I thought I have to test the actionCreators object to have truth values so I added the below code test('Testing Index File of "src/state/"', () => {
expect(actionCreators.installPlugin).toBeTruthy();
expect(actionCreators.removePlugin).toBeTruthy();
expect(actionCreators.updateInstalled).toBeTruthy();
expect(actionCreators.updatePluginLinks).toBeTruthy();
}) still I am getting coverage of 33% only.... |
try asking @asmitsirohi he will tell you |
You'll have to probably mock the state data and check the dispatch actions by using isEqualTo method. |
Thanks @Devesh21700Kumar. Can you provide an example in an existing test suite in the repo? |
Mocks have been created in children files of screen subFolder but they are Mocks for graphql queries and therefore are in a bit different format from what is needed. |
@SiddheshKukade, You are trying to test an actionCreaters by importing it, instead of the index file. Leave it for actionCreaters tests, for this, you have to mock the data. Actually, the src/state/index file has only one export statement, which is not necessary to test. Just to get 100% code coverage we can exclude it from code coverage, by referring to this article https://stackoverflow.com/questions/43044696/test-a-create-react-app-index-js-file. What's your view on this @yasharth291 @palisadoes. |
OK @asmitsirohi sir I will try this one |
…e(src/state/index.ts) as it contains only 1 line
@asmitsirohi @palisadoes @yasharth291 @Devesh21700Kumar what do you guys think about this change "coveragePathIgnorePatterns": ["src/state/index.ts"] so that it will not look for the src/state/index file as it contains one import statement |
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.
I apologize for the delayed review. This is good actually since the index.ts
file only contains an import statement
thank you @DangaRanga sir, @palisadoes @yasharth291 are the changes ok? |
What kind of change does this PR introduce?
Added Testcases for src/state/index.ts file
Issue Number:
#278
Fixes #278
Did you add tests for your changes?
Yes I have added a testfile
Summary
I have added a index.test.ts. file required for the issue #278 for Gsoc2022
Does this PR introduce a breaking change?
No
SnapShots
Have you read the contributing guide?
Yes