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,
|
isOceanNetwork: false,
|
||||||
account: '',
|
account: '',
|
||||||
web3: {},
|
web3: {},
|
||||||
ocean: {},
|
ocean: {
|
||||||
|
aquarius: {
|
||||||
|
queryMetadata: jest.fn()
|
||||||
|
}
|
||||||
|
},
|
||||||
balance: { eth: 0, ocn: 0 },
|
balance: { eth: 0, ocn: 0 },
|
||||||
network: '',
|
network: '',
|
||||||
requestFromFaucet: jest.fn(),
|
requestFromFaucet: jest.fn(),
|
||||||
@ -20,7 +24,11 @@ const userMockConnected = {
|
|||||||
isOceanNetwork: true,
|
isOceanNetwork: true,
|
||||||
account: '0xxxxxx',
|
account: '0xxxxxx',
|
||||||
web3: {},
|
web3: {},
|
||||||
ocean: {},
|
ocean: {
|
||||||
|
aquarius: {
|
||||||
|
queryMetadata: jest.fn()
|
||||||
|
}
|
||||||
|
},
|
||||||
balance: { eth: 0, ocn: 0 },
|
balance: { eth: 0, ocn: 0 },
|
||||||
network: '',
|
network: '',
|
||||||
requestFromFaucet: jest.fn(),
|
requestFromFaucet: jest.fn(),
|
||||||
|
@ -3,15 +3,19 @@ import { Router } from 'react-router'
|
|||||||
import { createBrowserHistory } from 'history'
|
import { createBrowserHistory } from 'history'
|
||||||
import { render } from 'react-testing-library'
|
import { render } from 'react-testing-library'
|
||||||
import Home from './Home'
|
import Home from './Home'
|
||||||
|
import { userMock } from '../../__mocks__/user-mock'
|
||||||
|
import { User } from '../context'
|
||||||
|
|
||||||
const history = createBrowserHistory()
|
const history = createBrowserHistory()
|
||||||
|
|
||||||
describe('Home', () => {
|
describe('Home', () => {
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
const { container } = render(
|
const { container } = render(
|
||||||
<Router history={history}>
|
<User.Provider value={{ ...userMock }}>
|
||||||
<Home history={history} />
|
<Router history={history}>
|
||||||
</Router>
|
<Home history={history} />
|
||||||
|
</Router>
|
||||||
|
</User.Provider>
|
||||||
)
|
)
|
||||||
expect(container.firstChild).toBeInTheDocument()
|
expect(container.firstChild).toBeInTheDocument()
|
||||||
})
|
})
|
||||||
|
@ -65,7 +65,7 @@ class Home extends Component<HomeProps, HomeState> {
|
|||||||
isLoading: false
|
isLoading: false
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error)
|
Logger.error(error.message)
|
||||||
this.setState({ isLoading: false })
|
this.setState({ isLoading: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,7 +96,7 @@ export default class Search extends PureComponent<SearchProps, SearchState> {
|
|||||||
isLoading: false
|
isLoading: false
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(error)
|
Logger.error(error.message)
|
||||||
this.setState({ isLoading: false })
|
this.setState({ isLoading: false })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user