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

feat(testing): add unit tests for constants #2701

Merged
merged 5 commits into from Feb 10, 2021
Merged

Conversation

jsjoeio
Copy link
Contributor

@jsjoeio jsjoeio commented Feb 8, 2021

This PR refactors a few lines of code in src/node/constants.ts and adds a few unit tests to bring code coverage for the file to 100%.

Changes

  • refactor constants and add getPackageJson function to make it easier to test
  • add @schemastore/package to devDeps to get PackageJson type
  • add unit tests for constants

Screenshot

image

It increases our code coverage (Lines) from 49.53% to 50.09% (↑ 0.56%).
🟩 100% Line coverage (last 100) for src/node/constants.ts
image

TODOS

  • update screenshot
  • update percentages

@jsjoeio jsjoeio self-assigned this Feb 8, 2021
@jsjoeio jsjoeio added this to the v3.8.2 milestone Feb 8, 2021
Copy link

@oxy oxy left a comment

Choose a reason for hiding this comment

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

Looks good! Just curious about the disappearing comment, mostly.

Comment on lines -65 to +67
"wtfnode": "^0.8.4",
"typescript": "^4.1.3"
"typescript": "^4.1.3",
"wtfnode": "^0.8.4"
Copy link

Choose a reason for hiding this comment

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

I wonder if this was a manual change or something done automatically? Not particularly an issue, just curious 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that happens when you add a new dependency to the top? Not sure, I did see it in one of Asher's PRs

Copy link
Member

Choose a reason for hiding this comment

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

Yeah yarn resorts the dependencies. 😄

Copy link
Member

Choose a reason for hiding this comment

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

The real question is how it got out of order in the first place lol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LOL I have no idea - could have been me 😂

Copy link
Member

Choose a reason for hiding this comment

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

Haha idk I say we just blame yarn.

Comment on lines -128 to -131
// Things to mock
// logger
// location
// document
Copy link

Choose a reason for hiding this comment

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

Comment disappeared! no other changes in this file; curious about the change

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 was intentional! See commit: 164d11e

@jsjoeio jsjoeio requested a review from oxy February 10, 2021 18:15
Copy link

@oxy oxy left a comment

Choose a reason for hiding this comment

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

LGTM!

@jsjoeio jsjoeio merged commit 662b5b2 into master Feb 10, 2021
@jsjoeio jsjoeio deleted the add-unit-tests-constants branch February 10, 2021 19:40
@jsjoeio jsjoeio added this to In progress in Improve Testing via automation Feb 24, 2021
@jsjoeio jsjoeio moved this from In progress to Done in Improve Testing Feb 24, 2021
@jsjoeio jsjoeio added the testing Anything related to testing label May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing Anything related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants