Skip to content

Improve test coverage for resolveObject and delayExecution#5895

Merged
omsuneri merged 2 commits intosugarlabs:masterfrom
Thesmoothengineer:improve-utils-coverage
Feb 25, 2026
Merged

Improve test coverage for resolveObject and delayExecution#5895
omsuneri merged 2 commits intosugarlabs:masterfrom
Thesmoothengineer:improve-utils-coverage

Conversation

@Thesmoothengineer
Copy link
Contributor

@Thesmoothengineer Thesmoothengineer commented Feb 24, 2026

What needs testing

Improved test coverage for utility functions in js/utils/utils.js :

  • resolveObject()
  • delayExecution()

Current coverage

Coverage for utils.js had low branch and edge-case coverage, especially for:

  • Error handling in resolveObject()
  • Edge inputs (null, non-string, empty string)
  • Async timing behavior in delayExecution()

Proposed approach

  • Added edge case tests for invalid and unexpected inputs
  • Added error-path test by simulating failure inside resolveObject()
  • Added async timing tests for delayExecution() using Jest fake timers
  • No production code was modified

Checklist

  • I have read and followed the project's code of conduct.
  • I have checked that no existing tests cover this area.
  • I have checked that there is no open PR for the tests I am submitting.
  • I have reviewed docs/TESTING.md for testing patterns.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

@github-actions
Copy link
Contributor

✅ All Jest tests passed! This PR is ready to merge.

Copy link
Contributor

@mahesh-09-12 mahesh-09-12 left a comment

Choose a reason for hiding this comment

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

@Thesmoothengineer good coverage of null-path and error branches in resolveObject. One concern - temporarily overriding String.prototype.split introduces global side effects, even if restored. It might be safer to mock the resolution logic more locally (like spy on the utility or wrap the call) to avoid prototype mutation, otherwise this meaningfully improves defensive coverage.

@omsuneri omsuneri merged commit af23222 into sugarlabs:master Feb 25, 2026
7 checks passed
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.

3 participants