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

Fix exception thrown in dashboard route test #22

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

benvinegar
Copy link
Owner

@benvinegar benvinegar commented Feb 1, 2024

The exception was caused because if you do not send a valid country code, the country name formatter will explode. The mock test data was sending "Canada", "United States", etc. when it should have been sending "CA", "US', etc.

This patch just addresses the input data so that the tests run (and adds some assertions, which should have been there from the beginning). The fundamental problem is still there: the Dashboard will choke if it's fed non-country code values, which seems really brittle. On the plus side the country codes are coming from Cloudflare's request object (vs arbitrary user data).

Fixes #21

Copy link

codecov bot commented Feb 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (86e6514) 50.41% compared to head (8874b50) 67.59%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main      #22       +/-   ##
===========================================
+ Coverage   50.41%   67.59%   +17.18%     
===========================================
  Files          18       18               
  Lines        1682     1682               
  Branches       69       94       +25     
===========================================
+ Hits          848     1137      +289     
+ Misses        828      539      -289     
  Partials        6        6               

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benvinegar benvinegar merged commit 7e4e561 into main Feb 1, 2024
3 checks passed
@benvinegar benvinegar deleted the fix-dashboard-tests branch February 1, 2024 03:44
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.

dashboard.test.tsx throws exception most of the time
1 participant