Skip to content
Snippets Groups Projects
Commit 21d53ffe authored by Atte Keinänen's avatar Atte Keinänen
Browse files

Remove Jest tests (bad snapshot tests, and E2E tests cover interactions well)

parent b165556b
Branches
Tags
No related merge requests found
export const noDashboardsList = [];
// Dump from a running app on 4/10/17
export const twoDashboardsList = [
{
description: 'For seeing the usual response times, feedback topics, our response rate, how often customers are directed to our knowledge base instead of providing a customized response',
creator: {
email: 'atte@metabase.com',
first_name: 'Atte',
last_login: '2017-04-10T23:56:12.562Z',
is_qbnewb: false,
is_superuser: false,
id: 1,
last_name: 'Keinänen',
date_joined: '2017-03-17T03:37:27.396Z',
common_name: 'Atte Keinänen'
},
enable_embedding: false,
show_in_getting_started: false,
name: 'Customer Feedback Analysis',
caveats: null,
creator_id: 1,
updated_at: '2017-04-05T00:23:20.991Z',
made_public_by_id: null,
embedding_params: null,
id: 3,
parameters: [
{
name: 'Date Range',
slug: 'date_range',
id: 'fc68dfa5',
type: 'date/range',
'default': '2017-03-07~2017-03-14'
}
],
created_at: '2017-03-28T23:24:16.891Z',
public_uuid: null,
points_of_interest: null
},
{
description: 'For seeing our progress over time, and if there are bottlenecks in our product development process',
creator: {
email: 'atte@metabase.com',
first_name: 'Atte',
last_login: '2017-04-10T23:56:12.562Z',
is_qbnewb: false,
is_superuser: false,
id: 1,
last_name: 'Keinänen',
date_joined: '2017-03-17T03:37:27.396Z',
common_name: 'Atte Keinänen'
},
enable_embedding: false,
show_in_getting_started: false,
name: 'Kanban Breakdown Chart',
caveats: null,
creator_id: 1,
updated_at: '2017-04-04T20:41:50.616Z',
made_public_by_id: null,
embedding_params: null,
id: 7,
parameters: [],
created_at: '2017-04-04T20:39:01.263Z',
public_uuid: null,
points_of_interest: null
}
];
import React from 'react';
import renderer from 'react-test-renderer';
import {Dashboards} from './Dashboards';
import {noDashboardsList, twoDashboardsList} from './Dashboards.spec.data';
function setupDashboards(dashboards) {
const props = {
dashboards: dashboards,
createDashboard: jest.fn(),
fetchDashboards: jest.fn()
}
const component = <Dashboards {...props} />
return {
props,
component
}
}
// Don't render Ellipsified as Tooltip class that it is using causes trouble
// (ReactDOM.findDOMNode not supported by react-test-renderer)
jest.mock('metabase/components/Ellipsified', () => () => null )
describe('Dashboards list view', () => {
it('should render correctly in loading state', () => {
const {component} = setupDashboards(null);
const tree = renderer.create(component).toJSON();
expect(tree).toMatchSnapshot()
})
it('should render correctly with zero dashboards', () => {
const {component} = setupDashboards(noDashboardsList);
const tree = renderer.create(component).toJSON();
expect(tree).toMatchSnapshot()
})
it('should render correctly with two dashboards', () => {
const {component} = setupDashboards(twoDashboardsList);
const tree = renderer.create(component).toJSON();
expect(tree).toMatchSnapshot()
})
})
\ No newline at end of file
exports[`Dashboards list view should render correctly in loading state 1`] = `
<div
className="relative mx4"
style={undefined}>
<div
className="wrapper py4 text-brand text-centered flex-full flex flex-column layout-centered bg-white">
<div
className={undefined}>
<div
className="LoadingSpinner"
style={
Object {
"borderWidth": 4,
"height": 32,
"width": 32,
}
} />
</div>
<h2
className="text-normal text-grey-2 mt1">
Loading...
</h2>
</div>
</div>
`;
exports[`Dashboards list view should render correctly with two dashboards 1`] = `
<div
className="relative mx4"
style={undefined}>
<div>
<div
className="flex align-center pt4 pb1">
<div
className="flex align-center">
<h2
className="mr1">
Dashboards
</h2>
</div>
<div
className="flex-align-right cursor-pointer text-grey-5 text-brand-hover">
<svg
className="Icon Icon-add"
fill="currentcolor"
height={20}
name="add"
onClick={[Function]}
size={20}
viewBox="0 0 32 32"
width={20}>
<path
d="M19,13 L19,2 L14,2 L14,13 L2,13 L2,18 L14,18 L14,30 L19,30 L19,18 L30,18 L30,13 L19,13 Z" />
</svg>
</div>
</div>
<div
className="flex align-center pb1">
<div
className={undefined}>
<svg
className={undefined}
fill="currentcolor"
height={18}
name="search"
size={18}
viewBox="0 0 32 32"
width={18}>
<path
d="M12 0 A12 12 0 0 0 0 12 A12 12 0 0 0 12 24 A12 12 0 0 0 18.5 22.25 L28 32 L32 28 L22.25 18.5 A12 12 0 0 0 24 12 A12 12 0 0 0 12 0 M12 4 A8 8 0 0 1 12 20 A8 8 0 0 1 12 4 " />
</svg>
<input
className="input"
onChange={[Function]}
placeholder="Filter this list..."
type="text"
value="" />
</div>
</div>
<ol
className="Grid Grid--guttersXl Grid--full small-Grid--1of2 md-Grid--1of3">
<li
className="Grid-cell flex-retain-width"
style={
Object {
"maxWidth": "550px",
}
}>
<a
className="flex align-center border-box p2 rounded no-decoration transition-background bg-white"
data-metabase-event="Navbar;Dashboards;Open Dashboard;3"
onClick={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"border": "1px solid rgba(220,225,228,0.50)",
"boxShadow": "0 1px 3px 0 rgba(220,220,220,0.50)",
"height": "80px",
}
}>
<svg
className="pr2 text-grey-1"
fill="currentcolor"
height={32}
name="dashboard"
size={32}
viewBox="0 0 32 32"
width={32}>
<path
d="M32,29 L32,4 L32,0 L0,0 L0,8 L28,8 L28,28 L4,28 L4,8 L0,8 L0,29.5 L0,32 L32,32 L32,29 Z M7.27272727,18.9090909 L17.4545455,18.9090909 L17.4545455,23.2727273 L7.27272727,23.2727273 L7.27272727,18.9090909 Z M7.27272727,12.0909091 L24.7272727,12.0909091 L24.7272727,16.4545455 L7.27272727,16.4545455 L7.27272727,12.0909091 Z M20.3636364,18.9090909 L24.7272727,18.9090909 L24.7272727,23.2727273 L20.3636364,23.2727273 L20.3636364,18.9090909 Z" />
</svg>
<div
className="flex-full flex-retain-width">
<h4
className="text-ellipsis text-nowrap overflow-hidden text-brand"
style={
Object {
"marginBottom": "0.2em",
}
} />
<div
className="text-smaller text-uppercase text-bold text-grey-3">
Mar 28, 2017
</div>
</div>
</a>
</li>
<li
className="Grid-cell flex-retain-width"
style={
Object {
"maxWidth": "550px",
}
}>
<a
className="flex align-center border-box p2 rounded no-decoration transition-background bg-white"
data-metabase-event="Navbar;Dashboards;Open Dashboard;7"
onClick={[Function]}
onMouseEnter={[Function]}
onMouseLeave={[Function]}
style={
Object {
"border": "1px solid rgba(220,225,228,0.50)",
"boxShadow": "0 1px 3px 0 rgba(220,220,220,0.50)",
"height": "80px",
}
}>
<svg
className="pr2 text-grey-1"
fill="currentcolor"
height={32}
name="dashboard"
size={32}
viewBox="0 0 32 32"
width={32}>
<path
d="M32,29 L32,4 L32,0 L0,0 L0,8 L28,8 L28,28 L4,28 L4,8 L0,8 L0,29.5 L0,32 L32,32 L32,29 Z M7.27272727,18.9090909 L17.4545455,18.9090909 L17.4545455,23.2727273 L7.27272727,23.2727273 L7.27272727,18.9090909 Z M7.27272727,12.0909091 L24.7272727,12.0909091 L24.7272727,16.4545455 L7.27272727,16.4545455 L7.27272727,12.0909091 Z M20.3636364,18.9090909 L24.7272727,18.9090909 L24.7272727,23.2727273 L20.3636364,23.2727273 L20.3636364,18.9090909 Z" />
</svg>
<div
className="flex-full flex-retain-width">
<h4
className="text-ellipsis text-nowrap overflow-hidden text-brand"
style={
Object {
"marginBottom": "0.2em",
}
} />
<div
className="text-smaller text-uppercase text-bold text-grey-3">
Apr 4, 2017
</div>
</div>
</a>
</li>
</ol>
</div>
</div>
`;
exports[`Dashboards list view should render correctly with zero dashboards 1`] = `
<div
className="relative mx4 flex-full flex align-center justify-center"
style={undefined}>
<div
className="mt2">
<div
className="text-centered text-brand-light my2"
style={
Object {
"width": "350px",
}
}>
<img
alt={
<span>
Put the charts and graphs you look at
<br />
frequently in a single, handy place.
</span>
}
className="mln2"
src="/app/img/dashboard_illustration.png"
srcSet="/app/img/dashboard_illustration@2x.png 2x"
width="300px" />
<div
className="flex justify-center">
<h2
className="text-grey-2 text-normal mt2 mb4"
style={
Object {
"lineHeight": "1.5em",
}
}>
<span>
Put the charts and graphs you look at
<br />
frequently in a single, handy place.
</span>
</h2>
</div>
<a
className="Button Button--primary mt4"
onClick={[Function]}>
Create a dashboard
</a>
</div>
</div>
</div>
`;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment