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

Archive notifier tests #619

Merged
merged 2 commits into from
Aug 19, 2020

Conversation

tklever
Copy link
Contributor

@tklever tklever commented Aug 18, 2020

Which problem is this PR solving?

  • Adding test coverage to an existing component

Short description of the changes

  • Adding unit tests for component ArchiveNotifier
  • A few minor cleanup items within the component itself

…nality

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
@codecov
Copy link

codecov bot commented Aug 18, 2020

Codecov Report

Merging #619 into master will increase coverage by 0.54%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #619      +/-   ##
==========================================
+ Coverage   92.88%   93.42%   +0.54%     
==========================================
  Files         227      227              
  Lines        5902     5902              
  Branches     1487     1486       -1     
==========================================
+ Hits         5482     5514      +32     
+ Misses        379      347      -32     
  Partials       41       41              
Impacted Files Coverage Δ
...src/components/TracePage/ArchiveNotifier/index.tsx 100.00% <100.00%> (+100.00%) ⬆️
...eViewer/TimelineHeaderRow/TimelineViewingLayer.tsx 89.83% <0.00%> (-1.70%) ⬇️

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 6843b03...6729f42. Read the comment docs.

@@ -73,7 +66,7 @@ function updateNotification(oldState: ENotifiedState | null, nextState: ENotifie
const { acknowledge, archivedState } = props;
if (nextState === ENotifiedState.Outcome) {
if (archivedState && archivedState.error) {
const error = typeof archivedState.error === 'string' ? archivedState.error : archivedState.error;
const { error } = archivedState;
Copy link
Member

Choose a reason for hiding this comment

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

what changed that makes it unnecessary to check for string type?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No change, if you look at the true and false side of the ternary, the true and false condition are the same.

? archivedState.error : archivedState.error

archivedState.error could be anything or nothing and this if statement will always return archievedState.error.

If I had to guess, this code might predate the partial adoption of typescript, typescript's transpiler will break if you put an inappropriate value in the error property. There might have been a check here that got refactored, but at current, it's an unnecessary code branch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just checked, this line was added in #194, it's always been this way. Probably just something that wasn't easy to spot without tests, hard to speculate.

@yurishkuro yurishkuro merged commit 0507ac8 into jaegertracing:master Aug 19, 2020
@tklever tklever deleted the ArchiveNotifier-tests branch August 23, 2020 06:30
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 4, 2021
* adding test coverage around current ArchiveNotifier component functionality

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>

* clean up some outdated comments and remove some erroneous logic

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 4, 2021
* adding test coverage around current ArchiveNotifier component functionality

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>

* clean up some outdated comments and remove some erroneous logic

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
vvvprabhakar pushed a commit to vvvprabhakar/jaeger-ui that referenced this pull request Jul 5, 2021
* adding test coverage around current ArchiveNotifier component functionality

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>

* clean up some outdated comments and remove some erroneous logic

Signed-off-by: Tim Klever <Tim.V.Klever@aexp.com>
Signed-off-by: vvvprabhakar <vvvprabhakar@gmail.com>
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.

2 participants