[web] Add tests for js/components/ContentView/DownloadContentButton.jsx

This commit is contained in:
Matthew Shao 2017-06-05 10:17:24 +08:00
parent f3c2123bc7
commit 46eae0a0b6
3 changed files with 29 additions and 0 deletions

View File

@ -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()
})
})

View File

@ -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>
`;

View File

@ -1,3 +1,4 @@
import React from 'react'
import { MessageUtils } from "../../flow/utils" import { MessageUtils } from "../../flow/utils"
import PropTypes from 'prop-types' import PropTypes from 'prop-types'