Commit 82e6da71 authored by Svein Olav Styve's avatar Svein Olav Styve

Merge branch 'refactor_tests' into 'master'

Refactor tests

See merge request !16
parents c23f8cfe 47ebcb1a
import React from 'react';
import ReactDOM from 'react-dom';
import renderer from 'react-test-renderer';
import Title from './components/Title';
// Example
describe('My Test Suite', () => {
it('My Test Case', () => {
expect(true).toEqual(true);
});
});
// Snapshot Test Title-component
describe('Title', () => {
test('snapshot renders', () => {
const component = renderer.create(<Title artwork={1}
categorySelections={{
textCat: 1,
imageCat: 1,
audioCat: 1,
}} />);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
// Render App, TODO-MAYBE: must mock lots of stuff...
// it('renders without crashing', () => {
// const div = document.createElement('div');
// ReactDOM.render(<App />, div);
// ReactDOM.unmountComponentAtNode(div);
// });
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Title snapshot renders 1`] = `
<h1
className="Title"
>
Artwork 2, txt 2, img 2, audio 2
</h1>
`;
import React from 'react';
import renderer from 'react-test-renderer';
import FavoriteSection from '../components/FavoriteSection';
// Snapshot Test FavoriteSection-component
describe('FavoriteSection', () => {
test('snapshot renders', () => {
const component = renderer.create(
<FavoriteSection open={() => {}} />);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
import React from 'react';
import renderer from 'react-test-renderer';
import TabElement from '../components/TabElement';
// Snapshot Test TabElement-component
describe('TabElement', () => {
test('snapshot renders', () => {
const component = renderer.create(
<TabElement id={1} onClick={() => {}} activeTab={1}/>);
let tree = component.toJSON();
expect(tree).toMatchSnapshot();
});
});
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`FavoriteSection snapshot renders 1`] = `
<div
className="Button-container"
>
<button
onClick={[Function]}
>
Save as favorite
</button>
<button
onClick={[Function]}
>
Open favourite
</button>
<p>
</p>
</div>
`;
exports[`TabElement snapshot renders 1`] = `
<div
className="Button-container"
>
<button
onClick={[Function]}
>
Save as favorite
</button>
<button
onClick={[Function]}
>
Open favourite
</button>
<p>
</p>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`TabElement snapshot renders 1`] = `
<div
className="active"
id={1}
onClick={[Function]}
>
Category
2
</div>
`;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment