1
0
mirror of https://github.com/oceanprotocol/commons.git synced 2023-03-15 18:03:00 +01:00

test tweaks

This commit is contained in:
Matthias Kretschmann 2019-05-15 17:37:36 +02:00
parent 92721702a0
commit 8497f6f9a2
Signed by: m
GPG Key ID: 606EEEF3C479A91F
4 changed files with 19 additions and 7 deletions

View File

@ -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(),

View File

@ -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()
})

View File

@ -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 })
}
}

View File

@ -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 })
}
}