Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
interface
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
LuckySwap
interface
Commits
f55062f9
Unverified
Commit
f55062f9
authored
Jul 28, 2023
by
cartcrom
Committed by
GitHub
Jul 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: mock quotes to avoid errors logged (#7031)
parent
1fde2504
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
7 deletions
+32
-7
SwapDetailsDropdown.test.tsx
src/components/swap/SwapDetailsDropdown.test.tsx
+1
-2
SwapDetailsDropdown.test.tsx.snap
...ents/swap/__snapshots__/SwapDetailsDropdown.test.tsx.snap
+17
-5
setupTests.ts
src/setupTests.ts
+14
-0
No files found.
src/components/swap/SwapDetailsDropdown.test.tsx
View file @
f55062f9
...
@@ -4,8 +4,7 @@ import { act, render, screen } from 'test-utils/render'
...
@@ -4,8 +4,7 @@ import { act, render, screen } from 'test-utils/render'
import
SwapDetailsDropdown
from
'
./SwapDetailsDropdown
'
import
SwapDetailsDropdown
from
'
./SwapDetailsDropdown
'
// TODO(WEB-2120): Reenable tests after mocking trade fetch in this file
describe
(
'
SwapDetailsDropdown.tsx
'
,
()
=>
{
describe
.
skip
(
'
SwapDetailsDropdown.tsx
'
,
()
=>
{
it
(
'
renders a trade
'
,
()
=>
{
it
(
'
renders a trade
'
,
()
=>
{
const
{
asFragment
}
=
render
(
const
{
asFragment
}
=
render
(
<
SwapDetailsDropdown
<
SwapDetailsDropdown
...
...
src/components/swap/__snapshots__/SwapDetailsDropdown.test.tsx.snap
View file @
f55062f9
...
@@ -235,7 +235,13 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
...
@@ -235,7 +235,13 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
<div
<div
class="c14 css-zhpkf8"
class="c14 css-zhpkf8"
>
>
$1.00
<div
class="c2 c11"
>
<div>
$1.00
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
...
@@ -288,9 +294,15 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
...
@@ -288,9 +294,15 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
</div>
</div>
</div>
</div>
<div
<div
class="c
9 css-zhpkf8
"
class="c
10
"
>
>
~$1.00
<div>
<div
class="c9 css-zhpkf8"
>
~$1.00
</div>
</div>
</div>
</div>
</div>
</div>
<div
<div
...
@@ -301,7 +313,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
...
@@ -301,7 +313,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
>
>
<div>
<div>
<div
<div
class="c1
2
css-zhpkf8"
class="c1
4
css-zhpkf8"
>
>
Price Impact
Price Impact
</div>
</div>
...
@@ -310,7 +322,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
...
@@ -310,7 +322,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
<div
<div
class="c9 css-zhpkf8"
class="c9 css-zhpkf8"
>
>
105566.37%
105566.37
3
%
</div>
</div>
</div>
</div>
<div
<div
...
...
src/setupTests.ts
View file @
f55062f9
...
@@ -73,6 +73,20 @@ jest.mock('@web3-react/core', () => {
...
@@ -73,6 +73,20 @@ jest.mock('@web3-react/core', () => {
}
}
})
})
jest
.
mock
(
'
state/routing/slice
'
,
()
=>
{
const
routingSlice
=
jest
.
requireActual
(
'
state/routing/slice
'
)
return
{
...
routingSlice
,
// Prevents unit tests from logging errors from failed getQuote queries
useGetQuoteQuery
:
()
=>
({
isError
:
false
,
data
:
undefined
,
error
:
undefined
,
currentData
:
undefined
,
}),
}
})
// Mocks are configured to reset between tests (by CRA), so they must be set in a beforeEach.
// Mocks are configured to reset between tests (by CRA), so they must be set in a beforeEach.
beforeEach
(()
=>
{
beforeEach
(()
=>
{
// Mock window.getComputedStyle, because it is otherwise too computationally expensive to unit test.
// Mock window.getComputedStyle, because it is otherwise too computationally expensive to unit test.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment