mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
test tweaks
This commit is contained in:
parent
92721702a0
commit
8497f6f9a2
@ -5,7 +5,11 @@ const userMock = {
|
||||
isOceanNetwork: false,
|
||||
account: '',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
ocean: {
|
||||
aquarius: {
|
||||
queryMetadata: jest.fn()
|
||||
}
|
||||
},
|
||||
balance: { eth: 0, ocn: 0 },
|
||||
network: '',
|
||||
requestFromFaucet: jest.fn(),
|
||||
@ -20,7 +24,11 @@ const userMockConnected = {
|
||||
isOceanNetwork: true,
|
||||
account: '0xxxxxx',
|
||||
web3: {},
|
||||
ocean: {},
|
||||
ocean: {
|
||||
aquarius: {
|
||||
queryMetadata: jest.fn()
|
||||
}
|
||||
},
|
||||
balance: { eth: 0, ocn: 0 },
|
||||
network: '',
|
||||
requestFromFaucet: jest.fn(),
|
||||
|
@ -3,15 +3,19 @@ import { Router } from 'react-router'
|
||||
import { createBrowserHistory } from 'history'
|
||||
import { render } from 'react-testing-library'
|
||||
import Home from './Home'
|
||||
import { userMock } from '../../__mocks__/user-mock'
|
||||
import { User } from '../context'
|
||||
|
||||
const history = createBrowserHistory()
|
||||
|
||||
describe('Home', () => {
|
||||
it('renders without crashing', () => {
|
||||
const { container } = render(
|
||||
<Router history={history}>
|
||||
<Home history={history} />
|
||||
</Router>
|
||||
<User.Provider value={{ ...userMock }}>
|
||||
<Router history={history}>
|
||||
<Home history={history} />
|
||||
</Router>
|
||||
</User.Provider>
|
||||
)
|
||||
expect(container.firstChild).toBeInTheDocument()
|
||||
})
|
||||
|
@ -65,7 +65,7 @@ class Home extends Component<HomeProps, HomeState> {
|
||||
isLoading: false
|
||||
})
|
||||
} catch (error) {
|
||||
Logger.error(error)
|
||||
Logger.error(error.message)
|
||||
this.setState({ isLoading: false })
|
||||
}
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
||||
isLoading: false
|
||||
})
|
||||
} catch (error) {
|
||||
Logger.error(error)
|
||||
Logger.error(error.message)
|
||||
this.setState({ isLoading: false })
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user