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

Test src test store #310

Merged

Conversation

SiddheshKukade
Copy link
Member

Note: this repeated PR from #299 due to some technical problems (you can visit #299 for more information)

What kind of change does this PR introduce?
Added Testcases for src/state/index.ts file

Issue Number:

#277

Fixes #277

Did you add tests for your changes?
Yes I have added a testfile

Summary
I have added a store.test.tsx file required for issue #277 for Gsoc2022

Does this PR introduce a breaking change?
No

SnapShots
image

Have you read the contributing guide?
Yes

@SiddheshKukade
Copy link
Member Author

@yasharth291 can you check now ?

Copy link
Contributor

@DangaRanga DangaRanga left a comment

Choose a reason for hiding this comment

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

Good job so far!

Please create separate tests/assertions for each property you're testing. As if the schema changes it could become difficult to pinpoint exactly what could be causing the tests to fail.

You could achieve this by setting up the state object to be global to this test suite before the tests, and then separating each test as follows:

Test for checking if the state has the required properties

test('State should contain the properties appRoutes and plugins',  () => {
....

}

Test to ensure that the appRoute's schema is as intended

test('appRoutes schema should contain targets, configUrl and components',  () => {
...

}

Test to ensure that the plugin's schema is as intended

test('plugins schema should contain installed, addOnStore and extras',  () => {
...

}

This would be an essential pattern to adopt as the size of the redux store increases, and as more functionality to be tested gets added

@SiddheshKukade
Copy link
Member Author

Good job so far!

Please create separate tests/assertions for each property you're testing. As if the schema changes it could become difficult to pinpoint exactly what could be causing the tests to fail.

You could achieve this by setting up the state object to be global to this test suite before the tests, and then separating each test as follows:

Test for checking if the state has the required properties

test('State should contain the properties appRoutes and plugins',  () => {
....

}

Test to ensure that the appRoute's schema is as intended

test('appRoutes schema should contain targets, configUrl and components',  () => {
...

}

Test to ensure that the plugin's schema is as intended

test('plugins schema should contain installed, addOnStore and extras',  () => {
...

}

This would be an essential pattern to adopt as the size of the redux store increases, and as more functionality to be tested gets added

Thank you sir for the response. I will apply assertions to test cases in a few minutes

@codecov-commenter
Copy link

Codecov Report

Merging #310 (fe64496) into develop (a0b63fe) will increase coverage by 8.15%.
The diff coverage is n/a.

@@             Coverage Diff             @@
##           develop     #310      +/-   ##
===========================================
+ Coverage    44.17%   52.33%   +8.15%     
===========================================
  Files           45       45              
  Lines          704      686      -18     
  Branches       149      147       -2     
===========================================
+ Hits           311      359      +48     
+ Misses         380      317      -63     
+ Partials        13       10       -3     
Impacted Files Coverage Δ
...s/AddOn/support/components/SidePanel/SidePanel.tsx 100.00% <ø> (+100.00%) ⬆️
...components/OrgPeopleListCard/OrgPeopleListCard.tsx 100.00% <ø> (+58.82%) ⬆️
src/components/OrgPostCard/OrgPostCard.tsx 100.00% <ø> (+63.63%) ⬆️
src/components/OrgUpdate/OrgUpdate.tsx 100.00% <ø> (+72.00%) ⬆️
...ns/OrganizationDashboard/OrganizationDashboard.tsx 91.66% <ø> (+14.74%) ⬆️
...c/components/OrganizationCard/OrganizationCard.tsx 100.00% <0.00%> (+33.33%) ⬆️
...ts/OrganizationCardStart/OrganizationCardStart.tsx 100.00% <0.00%> (+33.33%) ⬆️
... and 3 more

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@SiddheshKukade
Copy link
Member Author

@DangaRanga Sir Is this Ok ?

Copy link
Contributor

@palisadoes palisadoes left a comment

Choose a reason for hiding this comment

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

@SiddheshKukade What is the level of code coverage for the file. It's not visible in the CodeCov report. Please paste an image of the reporting of this value. We need to get to 100%

@SiddheshKukade
Copy link
Member Author

SiddheshKukade commented Mar 27, 2022

@SiddheshKukade What is the level of code coverage for the file. It's not visible in the CodeCov report. Please paste an image of the reporting of this value. We need to get to 100%
OK

I ran this coomand

 yarn test --coverage --watchAll=false

Output :
image

CODECOV report 👍

image

@palisadoes palisadoes merged commit 44e27ee into PalisadoesFoundation:develop Mar 27, 2022
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.

Code Coverage: Create tests for store.ts
5 participants