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
8089a7aa3e
commit
004f946d99
@ -46,7 +46,6 @@ describe('Files', () => {
|
|||||||
|
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
const { container } = render(ui)
|
const { container } = render(ui)
|
||||||
|
|
||||||
expect(container.firstChild).toBeInTheDocument()
|
expect(container.firstChild).toBeInTheDocument()
|
||||||
expect(container.querySelector('.itemForm')).not.toBeInTheDocument()
|
expect(container.querySelector('.itemForm')).not.toBeInTheDocument()
|
||||||
})
|
})
|
||||||
@ -82,22 +81,22 @@ describe('Files', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('item can be removed', () => {
|
it('item can be removed', () => {
|
||||||
const { getByTitle } = render(ui)
|
const { getAllByTitle } = render(ui)
|
||||||
|
fireEvent.click(getAllByTitle('Remove item')[0])
|
||||||
fireEvent.click(getByTitle('Remove item'))
|
|
||||||
expect(files.length).toBe(0)
|
expect(files.length).toBe(0)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('item can be added', async () => {
|
it('item can be added', async () => {
|
||||||
const { getByText, getByPlaceholderText } = render(ui)
|
const { getAllByText, getByText, getByPlaceholderText } = render(ui)
|
||||||
|
|
||||||
fireEvent.click(getByText('+ From URL'))
|
fireEvent.click(getAllByText('+ From URL')[0])
|
||||||
await waitForElement(() => getByText('- Cancel'))
|
await waitForElement(() => getByText('- Cancel'))
|
||||||
fireEvent.change(getByPlaceholderText('Hello'), {
|
fireEvent.change(getByPlaceholderText('Hello'), {
|
||||||
target: { value: 'https://hello.com' }
|
target: { value: 'https://hello.com' }
|
||||||
})
|
})
|
||||||
fireEvent.click(getByText('Add File'))
|
fireEvent.click(getByText('Add File'))
|
||||||
|
|
||||||
mockAxios.mockResponse(mockResponse)
|
mockAxios.mockResponse(mockResponse)
|
||||||
expect(mockAxios).toHaveBeenCalled()
|
expect(mockAxios.get).toHaveBeenCalled()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user