[web] mock components/ContentView
This commit is contained in:
parent
e1c5f2a93e
commit
b16a3ab083
|
@ -1,3 +1,4 @@
|
||||||
|
jest.mock('../../../components/ContentView')
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import renderer from 'react-test-renderer'
|
import renderer from 'react-test-renderer'
|
||||||
import TestUtils from 'react-dom/test-utils'
|
import TestUtils from 'react-dom/test-utils'
|
||||||
|
@ -10,21 +11,13 @@ import ContentView from '../../../components/ContentView'
|
||||||
import ContentViewOptions from '../../../components/ContentView/ContentViewOptions'
|
import ContentViewOptions from '../../../components/ContentView/ContentViewOptions'
|
||||||
import Headers from '../../../components/FlowView/Headers'
|
import Headers from '../../../components/FlowView/Headers'
|
||||||
import ValueEditor from '../../../components/ValueEditor/ValueEditor'
|
import ValueEditor from '../../../components/ValueEditor/ValueEditor'
|
||||||
import mockXMLHttpRequest from 'mock-xmlhttprequest'
|
|
||||||
|
|
||||||
global.XMLHttpRequest = mockXMLHttpRequest
|
|
||||||
global.fetch = jest.fn()
|
global.fetch = jest.fn()
|
||||||
|
|
||||||
let tflow = new TFlow(),
|
let tflow = new TFlow(),
|
||||||
store = TStore()
|
store = TStore()
|
||||||
store.getState().ui.flow.modifiedFlow = false
|
store.getState().ui.flow.modifiedFlow = false
|
||||||
|
|
||||||
mockXMLHttpRequest.onSend = xhr => {
|
|
||||||
let response = {result: 'success'},
|
|
||||||
responseHeaders = {'Content-Type': 'application/json'}
|
|
||||||
xhr.respond(200, responseHeaders, JSON.stringify(response))
|
|
||||||
}
|
|
||||||
|
|
||||||
describe('Request Component', () => {
|
describe('Request Component', () => {
|
||||||
|
|
||||||
afterEach(() => {store.clearActions()})
|
afterEach(() => {store.clearActions()})
|
||||||
|
|
|
@ -199,17 +199,6 @@ exports[`Request Component should render correctly 1`] = `
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<hr />
|
<hr />
|
||||||
<div
|
|
||||||
className="contentview"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="text-center"
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
className="fa fa-spinner fa-spin"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
</article>
|
||||||
<footer>
|
<footer>
|
||||||
<div
|
<div
|
||||||
|
@ -473,17 +462,6 @@ exports[`Response Component should render correctly 1`] = `
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<hr />
|
<hr />
|
||||||
<div
|
|
||||||
className="contentview"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
className="text-center"
|
|
||||||
>
|
|
||||||
<i
|
|
||||||
className="fa fa-spinner fa-spin"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</article>
|
</article>
|
||||||
<footer>
|
<footer>
|
||||||
<div
|
<div
|
||||||
|
|
Loading…
Reference in New Issue