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

ProcessDetailComponent test improvement #2408

Merged
merged 2 commits into from
Aug 8, 2023

Conversation

Atmire-Kristof
Copy link
Contributor

References

Description

This PR adds some improvements and fixes to test cases of ProcessDetailComponent

Instructions for Reviewers

The test that's being improved is a test responsible for the 5s refresh timer.

It's supposed to mimic a running process during this timer, but the process is set to COMPLETED from the start, so I've modified the test to set it to RUNNING from the start and only set it to COMPLETED 1 second before the timer ends, so that the end result can still be tested.

Because of this change, the test started failing because it expected refresh() and stopRefreshTimer() to execute their code, but they weren't. This is because they were being spied on using spyOn(component, 'refresh'), which stubs the entire method and stops it from executing altogether. Adding .and.callThrough(); to this fixes the issue and the methods are now spied upon, but will still execute their code.

The test cases succeed again after this, confirming they're functional.

Checklist

This checklist provides a reminder of what we are going to look for when reviewing your PR. You need not complete this checklist prior to creating your PR (draft PRs are always welcome). If you are unsure about an item in the checklist, don't hesitate to ask. We're here to help!

  • My PR is small in size (e.g. less than 1,000 lines of code, not including comments & specs/tests), or I have provided reasons as to why that's not possible.
  • My PR passes ESLint validation using yarn lint
  • My PR doesn't introduce circular dependencies (verified via yarn check-circ-deps)
  • My PR includes TypeDoc comments for all new (or modified) public methods and classes. It also includes TypeDoc for large or complex private methods.
  • My PR passes all specs/tests and includes new/updated specs or tests based on the Code Testing Guide.
  • If my PR includes new libraries/dependencies (in package.json), I've made sure their licenses align with the DSpace BSD License based on the Licensing of Contributions documentation.
  • If my PR includes new features or configurations, I've provided basic technical documentation in the PR itself.
  • If my PR fixes an issue ticket, I've linked them together.

@tdonohue tdonohue added bug testing framework Related specifically to Unit or Integration (e2e) Tests 1 APPROVAL pull request only requires a single approval to merge port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release labels Aug 1, 2023
@tdonohue tdonohue self-requested a review August 3, 2023 14:48
Copy link
Member

@tdonohue tdonohue left a comment

Choose a reason for hiding this comment

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

👍 Thanks @Atmire-Kristof ! This looks good to me. Code looks good and updated tests are passing.

@tdonohue tdonohue merged commit dc34cbe into DSpace:main Aug 8, 2023
8 checks passed
@dspace-bot
Copy link
Contributor

Backport failed for dspace-7_x, because it was unable to cherry-pick the commit(s).

Please cherry-pick the changes locally.

git fetch origin dspace-7_x
git worktree add -d .worktree/backport-2408-to-dspace-7_x origin/dspace-7_x
cd .worktree/backport-2408-to-dspace-7_x
git checkout -b backport-2408-to-dspace-7_x
ancref=$(git merge-base 1223e3c43865eef77f68d5c11f29009ab3550203 63e6e79750c71adaef0cc14671a8eb555e05d94e)
git cherry-pick -x $ancref..63e6e79750c71adaef0cc14671a8eb555e05d94e

@tdonohue tdonohue added this to the 8.0 milestone Aug 8, 2023
@tdonohue tdonohue removed the port to dspace-7_x This PR needs to be ported to `dspace-7_x` branch for next bug-fix release label Aug 8, 2023
@tdonohue
Copy link
Member

tdonohue commented Aug 8, 2023

Manual port created in #2427

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 APPROVAL pull request only requires a single approval to merge bug testing framework Related specifically to Unit or Integration (e2e) Tests
Projects
No open projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

3 participants