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

Tests: add component tests for tx history filter #3758

Merged
merged 2 commits into from
May 28, 2024

Conversation

mike10ca
Copy link
Contributor

@mike10ca mike10ca commented May 28, 2024

What it solves

Resolves #3759

How this PR fixes it

  • Add component tests for TxFilterForm

How to test it

  • Run tests and observe outcome

Copy link

github-actions bot commented May 28, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented May 28, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Two Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/transactions 74 KB (🟡 +49 B) 1.09 MB
/transactions/history 73.96 KB (🟡 +49 B) 1.09 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented May 28, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
79.4% (+0.12% 🔼)
11712/14750
🔴 Branches
58.44% (+0.3% 🔼)
2787/4769
🟡 Functions
66.57% (+0.19% 🔼)
1882/2827
🟢 Lines
80.75% (+0.12% 🔼)
10560/13078
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / index.tsx
100% 93.1% 100% 100%
🟢
... / index.tsx
94.44% 87.5% 100% 94.12%

Test suite run success

1477 tests passing in 203 suites.

Report generated by 🧪jest coverage report action from 579c701

@mike10ca mike10ca marked this pull request as ready for review May 28, 2024 11:54
const amountInput =
screen.getByTestId('amount-input').querySelector('input') ??
(() => {
throw new Error('Input element not found')
Copy link
Collaborator

Choose a reason for hiding this comment

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

why are you throwing here? On the next line you expect this element to be in the document?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had the error Type 'null' is not assignable to type 'Element | Node | Document | Window'.ts(2345) which was solved by adding that statement.

Copy link
Collaborator

Choose a reason for hiding this comment

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

that is strange

Copy link
Collaborator

Choose a reason for hiding this comment

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

you can do:
const amountInput = screen.getByTestId('amount-input').querySelector('input') as HTMLInputElement

this forced typescript to treat the amountinput as HtmlInputElement and it won't show you the ts error. Since you are checking that the element is in the document and if it isn't the test fails anyway I think that this a better way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed, thank you for feedback

@mike10ca mike10ca requested a review from compojoom May 28, 2024 12:02
Copy link
Collaborator

@compojoom compojoom left a comment

Choose a reason for hiding this comment

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

👍

@mike10ca mike10ca merged commit 53162c6 into dev May 28, 2024
14 checks passed
@mike10ca mike10ca deleted the history-filter-component-tests branch May 28, 2024 12:50
@github-actions github-actions bot locked and limited conversation to collaborators May 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tx history filter component automation tests
2 participants