[web] mock components/ContentView

This commit is contained in:
Matthew Shao 2017-05-31 18:22:28 +08:00
parent e1c5f2a93e
commit b16a3ab083
2 changed files with 1 additions and 30 deletions

View File

@ -1,3 +1,4 @@
jest.mock('../../../components/ContentView')
import React from 'react'
import renderer from 'react-test-renderer'
import TestUtils from 'react-dom/test-utils'
@ -10,21 +11,13 @@ import ContentView from '../../../components/ContentView'
import ContentViewOptions from '../../../components/ContentView/ContentViewOptions'
import Headers from '../../../components/FlowView/Headers'
import ValueEditor from '../../../components/ValueEditor/ValueEditor'
import mockXMLHttpRequest from 'mock-xmlhttprequest'
global.XMLHttpRequest = mockXMLHttpRequest
global.fetch = jest.fn()
let tflow = new TFlow(),
store = TStore()
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', () => {
afterEach(() => {store.clearActions()})

View File

@ -199,17 +199,6 @@ exports[`Request Component should render correctly 1`] = `
</tbody>
</table>
<hr />
<div
className="contentview"
>
<div
className="text-center"
>
<i
className="fa fa-spinner fa-spin"
/>
</div>
</div>
</article>
<footer>
<div
@ -473,17 +462,6 @@ exports[`Response Component should render correctly 1`] = `
</tbody>
</table>
<hr />
<div
className="contentview"
>
<div
className="text-center"
>
<i
className="fa fa-spinner fa-spin"
/>
</div>
</div>
</article>
<footer>
<div