test: mock quotes to avoid errors logged (#7031)
This commit is contained in:
parent
1fde2504b4
commit
f55062f9a9
@ -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
|
||||||
|
@ -235,12 +235,18 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
|
|||||||
<div
|
<div
|
||||||
class="c14 css-zhpkf8"
|
class="c14 css-zhpkf8"
|
||||||
>
|
>
|
||||||
|
<div
|
||||||
|
class="c2 c11"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
$1.00
|
$1.00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<svg
|
<svg
|
||||||
class="c15"
|
class="c15"
|
||||||
fill="none"
|
fill="none"
|
||||||
@ -287,12 +293,18 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="c10"
|
||||||
|
>
|
||||||
|
<div>
|
||||||
<div
|
<div
|
||||||
class="c9 css-zhpkf8"
|
class="c9 css-zhpkf8"
|
||||||
>
|
>
|
||||||
~$1.00
|
~$1.00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div
|
<div
|
||||||
class="c2 c3 c4"
|
class="c2 c3 c4"
|
||||||
>
|
>
|
||||||
@ -301,7 +313,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
|
|||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
class="c12 css-zhpkf8"
|
class="c14 css-zhpkf8"
|
||||||
>
|
>
|
||||||
Price Impact
|
Price Impact
|
||||||
</div>
|
</div>
|
||||||
@ -310,7 +322,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
|
|||||||
<div
|
<div
|
||||||
class="c9 css-zhpkf8"
|
class="c9 css-zhpkf8"
|
||||||
>
|
>
|
||||||
105566.37%
|
105566.373%
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
|
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user