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(common): improve test coverage for shared utils #14832

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BrahimAbdelli
Copy link

@BrahimAbdelli BrahimAbdelli commented Mar 23, 2025

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

Add tests for edge cases in shared utility functions
Adding type safety
Update normalizePath, isEmpty, stripEndSlash

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

- Add tests for edge cases in shared utility functions

- Fix issues with normalizePath and isEmpty
@coveralls
Copy link

coveralls commented Mar 23, 2025

Pull Request Test Coverage Report for Build 949bf200-490f-4ef9-bad7-32d6f1bf014e

Details

  • 63 of 64 (98.44%) changed or added relevant lines in 20 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.002%) to 89.298%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/common/utils/shared.utils.ts 23 24 95.83%
Totals Coverage Status
Change from base Build 207cf83d-d4c1-4e1c-9d67-76d032b5b52a: 0.002%
Covered Lines: 7159
Relevant Lines: 8017

💛 - Coveralls

- Fix isEmptyArray to return false for non-array values and array-like objects

- Update tests to align with the new behavior

- Add comprehensive test coverage for edge cases
I got an error when running npm run test:coverage.

The @nestjs/graphql package depends on the isEmpty function from @nestjs/common.

After renaming isEmpty to isEmptyArray, the @nestjs/graphql package can no longer find the isEmpty function, leading to the error.

To fix this issue, I restored the isEmpty function for the @nestjs/graphql package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants