Commit f55062f9 authored by cartcrom's avatar cartcrom Committed by GitHub

test: mock quotes to avoid errors logged (#7031)

parent 1fde2504
......@@ -4,8 +4,7 @@ import { act, render, screen } from 'test-utils/render'
import SwapDetailsDropdown from './SwapDetailsDropdown'
// TODO(WEB-2120): Reenable tests after mocking trade fetch in this file
describe.skip('SwapDetailsDropdown.tsx', () => {
describe('SwapDetailsDropdown.tsx', () => {
it('renders a trade', () => {
const { asFragment } = render(
<SwapDetailsDropdown
......
......@@ -235,12 +235,18 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
<div
class="c14 css-zhpkf8"
>
<div
class="c2 c11"
>
<div>
$1.00
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<svg
class="c15"
fill="none"
......@@ -287,12 +293,18 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
</div>
</div>
</div>
<div
class="c10"
>
<div>
<div
class="c9 css-zhpkf8"
>
~$1.00
</div>
</div>
</div>
</div>
<div
class="c2 c3 c4"
>
......@@ -301,7 +313,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
>
<div>
<div
class="c12 css-zhpkf8"
class="c14 css-zhpkf8"
>
Price Impact
</div>
......@@ -310,7 +322,7 @@ exports[`SwapDetailsDropdown.tsx renders a trade 1`] = `
<div
class="c9 css-zhpkf8"
>
105566.37%
105566.373%
</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.
beforeEach(() => {
// Mock window.getComputedStyle, because it is otherwise too computationally expensive to unit test.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment