aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-06-05 10:17:24 +0800
committerMatthew Shao <me@matshao.com>2017-06-05 10:17:24 +0800
commit46eae0a0b65e4064cd06658baf69957d37b503fe (patch)
treea9af2cda45f7b8747cba3419a9ec98b6deb0ea9e
parentf3c2123bc7c43d1f923f847e62ecdf749c7960c3 (diff)
downloadmitmproxy-46eae0a0b65e4064cd06658baf69957d37b503fe.tar.gz
mitmproxy-46eae0a0b65e4064cd06658baf69957d37b503fe.tar.bz2
mitmproxy-46eae0a0b65e4064cd06658baf69957d37b503fe.zip
[web] Add tests for js/components/ContentView/DownloadContentButton.jsx
-rw-r--r--web/src/js/__tests__/components/ContentView/DownloadContentButtonSpec.js15
-rw-r--r--web/src/js/__tests__/components/ContentView/__snapshots__/DownloadContentButtonSpec.js.snap13
-rw-r--r--web/src/js/components/ContentView/DownloadContentButton.jsx1
3 files changed, 29 insertions, 0 deletions
diff --git a/web/src/js/__tests__/components/ContentView/DownloadContentButtonSpec.js b/web/src/js/__tests__/components/ContentView/DownloadContentButtonSpec.js
new file mode 100644
index 00000000..fd00627d
--- /dev/null
+++ b/web/src/js/__tests__/components/ContentView/DownloadContentButtonSpec.js
@@ -0,0 +1,15 @@
+import React from 'react'
+import renderer from 'react-test-renderer'
+import DownloadContentButton from '../../../components/ContentView/DownloadContentButton'
+import { TFlow } from '../../ducks/tutils'
+
+let tflow = new TFlow()
+describe('DownloadContentButton Component', () => {
+ it('should render correctly', () => {
+ let downloadContentButton = renderer.create(
+ <DownloadContentButton flow={tflow} message={tflow.response}/>
+ ),
+ tree = downloadContentButton.toJSON()
+ expect(tree).toMatchSnapshot()
+ })
+})
diff --git a/web/src/js/__tests__/components/ContentView/__snapshots__/DownloadContentButtonSpec.js.snap b/web/src/js/__tests__/components/ContentView/__snapshots__/DownloadContentButtonSpec.js.snap
new file mode 100644
index 00000000..66900ca4
--- /dev/null
+++ b/web/src/js/__tests__/components/ContentView/__snapshots__/DownloadContentButtonSpec.js.snap
@@ -0,0 +1,13 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`DownloadContentButton Component should render correctly 1`] = `
+<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>
+`;
diff --git a/web/src/js/components/ContentView/DownloadContentButton.jsx b/web/src/js/components/ContentView/DownloadContentButton.jsx
index 447db211..f32a19ca 100644
--- a/web/src/js/components/ContentView/DownloadContentButton.jsx
+++ b/web/src/js/components/ContentView/DownloadContentButton.jsx
@@ -1,3 +1,4 @@
+import React from 'react'
import { MessageUtils } from "../../flow/utils"
import PropTypes from 'prop-types'