Skip to content
This repository has been archived by the owner on Aug 15, 2019. It is now read-only.

Unit tests #67

Merged
merged 22 commits into from Aug 10, 2019
Merged

Unit tests #67

merged 22 commits into from Aug 10, 2019

Conversation

biharck
Copy link
Contributor

@biharck biharck commented Aug 9, 2019

No description provided.

@biharck biharck requested a review from dannyrb August 9, 2019 14:14
Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

Hmm... I wonder why the DICOMWeb tests are showing up again? The tests for them are already merged:

Must be squash merge issue.

src/utils/addServer.test.js Outdated Show resolved Hide resolved
src/utils/guid.js Outdated Show resolved Hide resolved
src/utils/guid.test.js Outdated Show resolved Hide resolved
Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

Some small changes requested. See comments sprinkled throughout. Please re-request my review when changes are made, or if you have questions/comments.

@codecov
Copy link

codecov bot commented Aug 9, 2019

Codecov Report

Merging #67 into master will increase coverage by 1.31%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #67      +/-   ##
==========================================
+ Coverage    11.4%   12.71%   +1.31%     
==========================================
  Files         154      154              
  Lines        4426     4434       +8     
  Branches      908      910       +2     
==========================================
+ Hits          505      564      +59     
+ Misses       3099     3060      -39     
+ Partials      822      810      -12
Impacted Files Coverage Δ
src/utils/isImage.js 100% <100%> (+100%) ⬆️
src/utils/guid.js 100% <100%> (ø) ⬆️
src/utils/addServers.js 100% <100%> (+100%) ⬆️
src/utils/absoluteUrl.js 100% <100%> (+100%) ⬆️
src/utils/objectPath.js 91.89% <0%> (+91.89%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 60ca6f0...c959b12. Read the comment docs.

beforeEach(() => {
Math.random = jest.fn(() => 0.4677647565236618);
});
Math.random = jest.fn(() => 0.4677647565236618);
Copy link
Member

Choose a reason for hiding this comment

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

Will this bleed into a different test suite? Do you need to "undo" this patch after all of these tests have run?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. It won't right now but it is safe to add a clearAllMocks

Copy link
Member

Choose a reason for hiding this comment

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

@biharck, if you use Math.random somewhere else, I think it would still be a jest.fn? Doesn't clearAllMocks just reset the function so you can see what args are passed?

I think you need to do something like...

const savedFn = Math.random;
Math.random = jest.fn();
// after all
Math.random = savedFn;

Copy link
Member

Choose a reason for hiding this comment

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

For example: jestjs/jest#7136 (comment)

But I think you're right that Math.random calls in other test suites would use the baked in implementation, and not the one we override here.

@biharck biharck requested a review from dannyrb August 9, 2019 20:41
@dannyrb dannyrb merged commit d126655 into master Aug 10, 2019
Copy link
Member

@dannyrb dannyrb left a comment

Choose a reason for hiding this comment

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

👍

@ohif-bot
Copy link
Member

🎉 This PR is included in version 0.11.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants