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

tests for src/lib/resolvers/Subscription/messageSentToGroupChat.ts #1095

Closed
wants to merge 5 commits into from

Conversation

KrutikaBhatt
Copy link
Contributor

@KrutikaBhatt KrutikaBhatt commented Feb 27, 2023

What kind of change does this PR introduce?

Issue Number: #889

Fixes #889

Description:
Written tests for messageSentToGroupChat subscription by creating a mock test GroupChat Message.

Did you add tests for your changes? : Yes

Snapshots/Videos:
The coverage obtained is 100%
image

Other information
The subscription uses withFilter which has a filter function parameter that returns true if the user in the GroupChat is currentUser. The code block is the same just converted into a separate function for testing and used in the subscription

Have you read the contributing guide? Yes

@Cioppolo14
Copy link
Contributor

@KrutikaBhatt Please refer to the PR_GUIDELINES.md document in the root folder of the repo. It tells you how to automatically close your issue when the PR is merged.

@KrutikaBhatt
Copy link
Contributor Author

@KrutikaBhatt Please refer to the PR_GUIDELINES.md document in the root folder of the repo. It tells you how to automatically close your issue when the PR is merged.

Yes, sure! Will follow

Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

Why package-lock.json is removed ? @KrutikaBhatt

@KrutikaBhatt
Copy link
Contributor Author

KrutikaBhatt commented Feb 28, 2023

No, it shouldn't be removed; it might be edited by mistake. I will make the changes

package-lock.json Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Feb 28, 2023

Codecov Report

Merging #1095 (5681888) into develop (83f22af) will increase coverage by 0.31%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #1095      +/-   ##
===========================================
+ Coverage    94.70%   95.01%   +0.31%     
===========================================
  Files          165      165              
  Lines         9889     9891       +2     
  Branches       802      805       +3     
===========================================
+ Hits          9365     9398      +33     
+ Misses         523      492      -31     
  Partials         1        1              
Impacted Files Coverage Δ
...c/resolvers/Subscription/messageSentToGroupChat.ts 100.00% <100.00%> (+100.00%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@KrutikaBhatt
Copy link
Contributor Author

KrutikaBhatt commented Mar 1, 2023

The only branch not covered -

This change was introduced to avoid the 'object may be undefined' typescript error.

@KrutikaBhatt
Copy link
Contributor Author

@noman2002, I have covered the remaining branch also. The code coverage is shown below -

image

@palisadoes palisadoes requested a review from noman2002 March 2, 2023 06:39
Copy link
Member

@noman2002 noman2002 left a comment

Choose a reason for hiding this comment

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

package-lock.json is still not restored. please restore.

@KrutikaBhatt
Copy link
Contributor Author

package-lock.json is still not restored. please restore.

I just copied the package-lock.json from main file. I will just create a new pull request with the same tests. to avoid any problems with package-lock.json

@KrutikaBhatt
Copy link
Contributor Author

I am closing this PR. The same tests are covered in new PR - #1113

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.

Test: src/lib/resolvers/Subscription/messageSentToGroupChat.ts
3 participants