mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-20 00:08:02 +01:00
Add a few snapshot tests
This commit is contained in:
parent
a33aed3461
commit
ff8b11af4d
38
frontend/src/__mocks__/react-mdl.js
vendored
38
frontend/src/__mocks__/react-mdl.js
vendored
@ -1,20 +1,22 @@
|
||||
module.exports = {
|
||||
Card: 'react-mdl-Card',
|
||||
CardTitle: 'react-mdl-CardTitle',
|
||||
CardText: 'react-mdl-CardText',
|
||||
CardMenu: 'react-mdl-CardMenu',
|
||||
DataTable: 'react-mdl-DataTable',
|
||||
Cell: 'react-mdl-Cell',
|
||||
Grid: 'react-mdl-Grid',
|
||||
Icon: 'react-mdl-Icon',
|
||||
IconButton: 'react-mdl-IconButton',
|
||||
List: 'react-mdl-List',
|
||||
ListItem: 'react-mdl-ListItem',
|
||||
ListItemContent: 'react-mdl-ListItemContent',
|
||||
ProgressBar: 'react-mdl-ProgressBar',
|
||||
Switch: 'react-mdl-Switch',
|
||||
Tab: 'react-mdl-Tab',
|
||||
Tabs: 'react-mdl-Tabs',
|
||||
TableHeader: 'react-mdl-TableHeader',
|
||||
Textfield: 'react-mdl-Textfield',
|
||||
Card: "react-mdl-Card",
|
||||
CardTitle: "react-mdl-CardTitle",
|
||||
CardText: "react-mdl-CardText",
|
||||
CardMenu: "react-mdl-CardMenu",
|
||||
DataTable: "react-mdl-DataTable",
|
||||
Cell: "react-mdl-Cell",
|
||||
Grid: "react-mdl-Grid",
|
||||
Icon: "react-mdl-Icon",
|
||||
IconButton: "react-mdl-IconButton",
|
||||
List: "react-mdl-List",
|
||||
ListItem: "react-mdl-ListItem",
|
||||
ListItemContent: "react-mdl-ListItemContent",
|
||||
ProgressBar: "react-mdl-ProgressBar",
|
||||
Switch: "react-mdl-Switch",
|
||||
Tab: "react-mdl-Tab",
|
||||
Tabs: "react-mdl-Tabs",
|
||||
TableHeader: "react-mdl-TableHeader",
|
||||
Textfield: "react-mdl-Textfield",
|
||||
FooterSection: "react-mdl-FooterSection",
|
||||
FooterLinkList: "react-mdl-FooterLinkList"
|
||||
};
|
||||
|
5
frontend/src/component/api/__tests__/.eslintrc
Normal file
5
frontend/src/component/api/__tests__/.eslintrc
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"env": {
|
||||
"jest": true
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders correctly with details 1`] = `
|
||||
<react-mdl-FooterSection
|
||||
logo="Unleash 1.1.0"
|
||||
type="bottom"
|
||||
>
|
||||
<react-mdl-FooterLinkList>
|
||||
<a
|
||||
href="https://github.com/Unleash/unleash/"
|
||||
target="_blank"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
<a
|
||||
href="https://www.finn.no"
|
||||
target="_blank"
|
||||
>
|
||||
<small>
|
||||
A product by
|
||||
</small>
|
||||
FINN.no
|
||||
</a>
|
||||
</react-mdl-FooterLinkList>
|
||||
</react-mdl-FooterSection>
|
||||
`;
|
||||
|
||||
exports[`renders correctly with empty api details 1`] = `
|
||||
<react-mdl-FooterSection
|
||||
logo="Unleash "
|
||||
type="bottom"
|
||||
>
|
||||
<react-mdl-FooterLinkList>
|
||||
<a
|
||||
href="https://github.com/Unleash/unleash/"
|
||||
target="_blank"
|
||||
>
|
||||
GitHub
|
||||
</a>
|
||||
<a
|
||||
href="https://www.finn.no"
|
||||
target="_blank"
|
||||
>
|
||||
<small>
|
||||
A product by
|
||||
</small>
|
||||
FINN.no
|
||||
</a>
|
||||
</react-mdl-FooterLinkList>
|
||||
</react-mdl-FooterSection>
|
||||
`;
|
@ -0,0 +1,18 @@
|
||||
import React from 'react';
|
||||
|
||||
import ShowApiDetailsComponent from '../show-api-details-component';
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
jest.mock('react-mdl');
|
||||
|
||||
test('renders correctly with empty api details', () => {
|
||||
const tree = renderer.create(<ShowApiDetailsComponent fetchAll={jest.fn()} apiDetails={{}} />).toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('renders correctly with details', () => {
|
||||
const tree = renderer
|
||||
.create(<ShowApiDetailsComponent fetchAll={jest.fn()} apiDetails={{ version: '1.1.0' }} />)
|
||||
.toJSON();
|
||||
expect(tree).toMatchSnapshot();
|
||||
});
|
@ -1,8 +1,8 @@
|
||||
import React from 'react';
|
||||
import React, { Component } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { FooterSection, FooterLinkList } from 'react-mdl';
|
||||
|
||||
export default class ShowApiDetailsComponent extends React.Component {
|
||||
class ShowApiDetailsComponent extends Component {
|
||||
static propTypes = {
|
||||
apiDetails: PropTypes.object.isRequired,
|
||||
fetchAll: PropTypes.func.isRequired,
|
||||
@ -28,3 +28,5 @@ export default class ShowApiDetailsComponent extends React.Component {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default ShowApiDetailsComponent;
|
||||
|
Loading…
Reference in New Issue
Block a user