Commit fd9d857c authored by Turid Cecilie Dahl's avatar Turid Cecilie Dahl
Browse files

Merge remote-tracking branch 'origin/test_cleaning' into turid_sandbox

parents 932dca1f b90e5d5f
...@@ -5738,9 +5738,9 @@ ...@@ -5738,9 +5738,9 @@
"integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ==" "integrity": "sha512-d4sze1JNC454Wdo2fkuyzCr6aHcbL6PGGuFAz0Li/NcOm1tCHGnWDRmJP85dh9IhQErTc2svWFEX5xHIOo//kQ=="
}, },
"handlebars": { "handlebars": {
"version": "4.2.0", "version": "4.3.1",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.2.0.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.3.1.tgz",
"integrity": "sha512-Kb4xn5Qh1cxAKvQnzNWZ512DhABzyFNmsaJf3OAkWNa4NkaqWcNI8Tao8Tasi0/F4JD9oyG0YxuFyvyR57d+Gw==", "integrity": "sha512-c0HoNHzDiHpBt4Kqe99N8tdLPKAnGCQ73gYMPWtAYM4PwGnf7xl8PBUHJqh9ijlzt2uQKaSRxbXRt+rZ7M2/kA==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
...@@ -6939,7 +6939,7 @@ ...@@ -6939,7 +6939,7 @@
"bundled": true, "bundled": true,
"optional": true, "optional": true,
"requires": { "requires": {
"minimatch": "3.0.4" "minimatch": "^3.0.4"
} }
}, },
"inflight": { "inflight": {
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
"eslintConfig": { "eslintConfig": {
"extends": "react-app" "extends": "react-app"
}, },
"browserslist": { "browserslist": {
"production": [ "production": [
">0.2%", ">0.2%",
......
import React from 'react'; import React from 'react';
import App from '../App'; import App from '../App';
import { create } from 'react-test-renderer' import renderer from 'react-test-renderer'
describe('My first snapshot test',()=>{ describe('Testing App.js',()=>{
test('testing App.js', () => {
let tree = create(<App />) test('Snapshot match test', () => {
expect(tree.toJSON()).toMatchSnapshot(); const tree = renderer.create(<App />).toJSON();
}) expect(tree).toMatchSnapshot();
})
}) })
\ No newline at end of file
import React from 'react';
import Header from '../components/header.jsx';
import renderer from 'react-test-renderer'
describe('Testing header.jsx',()=>{
test('Snapshot match test', () => {
const tree = renderer.create(<Header />).toJSON();
expect(tree).toMatchSnapshot();
})
})
\ No newline at end of file
...@@ -3,21 +3,6 @@ import MiddlePart from '../components/MiddlePart'; ...@@ -3,21 +3,6 @@ import MiddlePart from '../components/MiddlePart';
import { create } from 'react-test-renderer' import { create } from 'react-test-renderer'
describe('Testing the index state',()=>{ describe('Testing the index state',()=>{
beforeAll(() => {
})
afterAll(() => {
})
beforeEach(() => {
})
afterEach(() => {
})
test('testing if the index state variable increments when the nextButton is pressed', () => { test('testing if the index state variable increments when the nextButton is pressed', () => {
let tree = create(<MiddlePart />) let tree = create(<MiddlePart />)
...@@ -29,8 +14,6 @@ describe('Testing the index state',()=>{ ...@@ -29,8 +14,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(1); expect(instance.state.currentIndex).toBe(1);
expect(tree.toJSON()).toMatchSnapshot()
}) })
test('testing if the index state variable deincrements when the prevButton is pressed', () => { test('testing if the index state variable deincrements when the prevButton is pressed', () => {
...@@ -43,8 +26,6 @@ describe('Testing the index state',()=>{ ...@@ -43,8 +26,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(3); expect(instance.state.currentIndex).toBe(3);
expect(tree.toJSON()).toMatchSnapshot()
}) })
test('testing if the index state variable changes to 0 when the first navigation button is pressed.', () => { test('testing if the index state variable changes to 0 when the first navigation button is pressed.', () => {
...@@ -57,8 +38,6 @@ describe('Testing the index state',()=>{ ...@@ -57,8 +38,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(0); expect(instance.state.currentIndex).toBe(0);
expect(tree.toJSON()).toMatchSnapshot()
}) })
test('testing if the index state variable changes to 1 when the second navigation button is pressed.', () => { test('testing if the index state variable changes to 1 when the second navigation button is pressed.', () => {
...@@ -71,8 +50,6 @@ describe('Testing the index state',()=>{ ...@@ -71,8 +50,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(1); expect(instance.state.currentIndex).toBe(1);
expect(tree.toJSON()).toMatchSnapshot()
}) })
test('testing if the index state variable changes to 2 when the third navigation button is pressed.', () => { test('testing if the index state variable changes to 2 when the third navigation button is pressed.', () => {
...@@ -85,8 +62,6 @@ describe('Testing the index state',()=>{ ...@@ -85,8 +62,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(2); expect(instance.state.currentIndex).toBe(2);
expect(tree.toJSON()).toMatchSnapshot()
}) })
test('testing if the index state variable changes to 3 when the fourth navigation button is pressed.', () => { test('testing if the index state variable changes to 3 when the fourth navigation button is pressed.', () => {
...@@ -99,8 +74,6 @@ describe('Testing the index state',()=>{ ...@@ -99,8 +74,6 @@ describe('Testing the index state',()=>{
// currentIndex property is updated to `true` // currentIndex property is updated to `true`
expect(instance.state.currentIndex).toBe(3); expect(instance.state.currentIndex).toBe(3);
expect(tree.toJSON()).toMatchSnapshot()
}) })
}) })
\ No newline at end of file
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`My first snapshot test testing App.js 1`] = `
<div>
<div>
<div
className="header"
id="header"
>
Bilder, tekst og lyd
<button
className="sidebarButton"
onClick={[Function]}
>
knapp
</button>
</div>
</div>
<div
className="screenBox"
>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="prevBtn"
onClick={[Function]}
>
</button>
</div>
<div
className="screenBoxWrapper"
>
<div
className="container main"
>
<meta
content="width=device-width, initial-scale=1.0"
name="viewport"
/>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
id="svg-container"
>
<img
alt="BILDE"
className="picture"
src="img1.jpg"
/>
</div>
</div>
</div>
<div
className="container col"
>
<div
className="box text"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box text"
>
<p>
Ernest Hemingway once wrote, “The world is a fine place, and worth fighting for.” I agree with the second part.
</p>
<q>
David Fincher
</q>
</div>
</div>
</div>
<div
className="box sound"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box sound"
>
<audio
controls={true}
src="Cat.mp3"
type="audio/mpeg"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="nextBtn"
onClick={[Function]}
>
</button>
</div>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
</div>
</div>
<div
className="sidebar"
>
<div
className="sidebar"
>
<div
className="sidebarAnimals"
>
<h5>
Animals
</h5>
<form>
<div
className="sidebar"
>
<label>
<input
checked={true}
onChange={[Function]}
type="radio"
value="cat"
/>
Cat
</label>
</div>
<div
className="radio"
>
<label>
<input
checked={false}
onChange={[Function]}
type="radio"
value="horse"
/>
Horse
</label>
</div>
<div
className="radio"
>
<label>
<input
checked={false}
onChange={[Function]}
type="radio"
value="donkey"
/>
Donkey
</label>
</div>
</form>
</div>
</div>
</div>
<button
onClick={[Function]}
>
Click meeee!
</button>
</div>
`;
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Testing the index state testing if the index state variable changes to 0 when the first navigation button is pressed. 1`] = `
<div
className="screenBox"
>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="prevBtn"
onClick={[Function]}
>
</button>
</div>
<div
className="screenBoxWrapper"
>
<div
className="container main"
>
<meta
content="width=device-width, initial-scale=1.0"
name="viewport"
/>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
id="svg-container"
>
<img
alt="BILDE"
className="picture"
src="img1.jpg"
/>
</div>
</div>
</div>
<div
className="container col"
>
<div
className="box text"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box text"
>
<p>
Ernest Hemingway once wrote, “The world is a fine place, and worth fighting for.” I agree with the second part.
</p>
<q>
David Fincher
</q>
</div>
</div>
</div>
<div
className="box sound"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box sound"
>
<audio
controls={true}
src="Cat.mp3"
type="audio/mpeg"
/>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="nextBtn"
onClick={[Function]}
>
</button>
</div>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
<button
className="dot"
onClick={[Function]}
/>
</div>
</div>
`;
exports[`Testing the index state testing if the index state variable changes to 1 when the second navigation button is pressed. 1`] = `
<div
className="screenBox"
>
<div
style={
Object {
"display": "flex",
}
}
>
<button
className="prevBtn"
onClick={[Function]}
>
</button>
</div>
<div
className="screenBoxWrapper"
>
<div
className="container main"
>
<meta
content="width=device-width, initial-scale=1.0"
name="viewport"
/>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
>
<div
style={
Object {
"display": "flex",
}
}
>
<div
className="box image"
id="svg-container"
>
<img
alt="BILDE"
className="picture"
src="img2.jpg"
/>
</div>
</div>
</div>
<div
className="container col"
>
<div
className="box text"
>