mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-25 18:03:50 +00:00
[web] Add tests for js/components/ContentView/MetaViews.jsx
This commit is contained in:
parent
46eae0a0b6
commit
298ac8391e
37
web/src/js/__tests__/components/ContentView/MetaViewsSpec.js
Normal file
37
web/src/js/__tests__/components/ContentView/MetaViewsSpec.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import renderer from 'react-test-renderer'
|
||||||
|
import { ContentEmpty, ContentMissing, ContentTooLarge } from '../../../components/ContentView/MetaViews'
|
||||||
|
import { TFlow } from '../../ducks/tutils'
|
||||||
|
|
||||||
|
let tflow = new TFlow()
|
||||||
|
|
||||||
|
describe('ContentEmpty Components', () => {
|
||||||
|
it('should render correctly', () => {
|
||||||
|
let contentEmpty = renderer.create(<ContentEmpty flow={tflow} message={tflow.response}/>),
|
||||||
|
tree = contentEmpty.toJSON()
|
||||||
|
expect(tree).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('ContentMissing Components', () => {
|
||||||
|
it('should render correctly', () => {
|
||||||
|
let contentMissing = renderer.create(<ContentMissing flow={tflow} message={tflow.response}/>),
|
||||||
|
tree = contentMissing.toJSON()
|
||||||
|
expect(tree).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('ContentTooLarge Components', () => {
|
||||||
|
it('should render correctly', () => {
|
||||||
|
let clickFn = jest.fn(),
|
||||||
|
uploadContentFn = jest.fn(),
|
||||||
|
contentTooLarge = renderer.create(<ContentTooLarge
|
||||||
|
flow={tflow}
|
||||||
|
message={tflow.response}
|
||||||
|
onClick={clickFn}
|
||||||
|
uploadContent={uploadContentFn}
|
||||||
|
/>),
|
||||||
|
tree = contentTooLarge.toJSON()
|
||||||
|
expect(tree).toMatchSnapshot()
|
||||||
|
})
|
||||||
|
})
|
@ -0,0 +1,66 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`ContentEmpty Components should render correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className="alert alert-info"
|
||||||
|
>
|
||||||
|
No
|
||||||
|
response
|
||||||
|
content.
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`ContentMissing Components should render correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className="alert alert-info"
|
||||||
|
>
|
||||||
|
Response
|
||||||
|
content missing.
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`ContentTooLarge Components should render correctly 1`] = `
|
||||||
|
<div>
|
||||||
|
<div
|
||||||
|
className="alert alert-warning"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
className="btn btn-xs btn-warning pull-right"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Display anyway
|
||||||
|
</button>
|
||||||
|
7b
|
||||||
|
content size.
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
className="view-options text-center"
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className="btn btn-default btn-xs"
|
||||||
|
href="#"
|
||||||
|
onClick={[Function]}
|
||||||
|
title="Upload a file to replace the content."
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-fw fa-upload"
|
||||||
|
/>
|
||||||
|
<input
|
||||||
|
className="hidden"
|
||||||
|
onChange={[Function]}
|
||||||
|
type="file"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
|
||||||
|
<a
|
||||||
|
className="btn btn-default btn-xs"
|
||||||
|
href="/flows/d91165be-ca1f-4612-88a9-c0f8696f3e29/response/content"
|
||||||
|
title="Download the content of the flow."
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
className="fa fa-download"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
Loading…
Reference in New Issue
Block a user