correct sort order of css properties
mocking of fetch api only once in setupTests
This commit is contained in:
		@@ -2,14 +2,6 @@ import {shallow} from "enzyme";
 | 
			
		||||
import React from "react";
 | 
			
		||||
import GeneralSettings from "./GeneralSettings";
 | 
			
		||||
 | 
			
		||||
function prepareFetchApi(response) {
 | 
			
		||||
    const mockJsonPromise = Promise.resolve(response);
 | 
			
		||||
    const mockFetchPromise = Promise.resolve({
 | 
			
		||||
        json: () => mockJsonPromise,
 | 
			
		||||
    });
 | 
			
		||||
    return (jest.fn().mockImplementation(() => mockFetchPromise));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('<GeneralSettings/>', function () {
 | 
			
		||||
    it('renders without crashing ', function () {
 | 
			
		||||
        const wrapper = shallow(<GeneralSettings/>);
 | 
			
		||||
@@ -28,7 +20,7 @@ describe('<GeneralSettings/>', function () {
 | 
			
		||||
    it('test savesettings', done => {
 | 
			
		||||
        const wrapper = shallow(<GeneralSettings/>);
 | 
			
		||||
 | 
			
		||||
        global.fetch = prepareFetchApi({success: true});
 | 
			
		||||
        global.fetch = global.prepareFetchApi({success: true});
 | 
			
		||||
 | 
			
		||||
        expect(global.fetch).toBeCalledTimes(0);
 | 
			
		||||
        const fakeEvent = {preventDefault: () => console.log('preventDefault')};
 | 
			
		||||
@@ -46,7 +38,7 @@ describe('<GeneralSettings/>', function () {
 | 
			
		||||
    it('test failing savesettings', done => {
 | 
			
		||||
        const wrapper = shallow(<GeneralSettings/>);
 | 
			
		||||
 | 
			
		||||
        global.fetch = prepareFetchApi({success: false});
 | 
			
		||||
        global.fetch = global.prepareFetchApi({success: false});
 | 
			
		||||
 | 
			
		||||
        expect(global.fetch).toBeCalledTimes(0);
 | 
			
		||||
        const fakeEvent = {preventDefault: () => console.log('preventDefault')};
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,13 @@
 | 
			
		||||
.indextextarea {
 | 
			
		||||
    margin-top: 15px;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
 | 
			
		||||
    overflow-y: scroll;
 | 
			
		||||
    overflow-x: auto;
 | 
			
		||||
 | 
			
		||||
    min-height: 100px;
 | 
			
		||||
    max-height: 300px;
 | 
			
		||||
    width: 50%;
 | 
			
		||||
    background-color: #c2c2c2;
 | 
			
		||||
    border-radius: 5px;
 | 
			
		||||
 | 
			
		||||
    margin-top: 15px;
 | 
			
		||||
    max-height: 300px;
 | 
			
		||||
 | 
			
		||||
    min-height: 100px;
 | 
			
		||||
    overflow-x: auto;
 | 
			
		||||
    overflow-y: scroll;
 | 
			
		||||
    padding: 10px;
 | 
			
		||||
    width: 50%;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,14 +2,6 @@ import {shallow} from "enzyme";
 | 
			
		||||
import React from "react";
 | 
			
		||||
import MovieSettings from "./MovieSettings";
 | 
			
		||||
 | 
			
		||||
function prepareFetchApi(response) {
 | 
			
		||||
    const mockJsonPromise = Promise.resolve(response);
 | 
			
		||||
    const mockFetchPromise = Promise.resolve({
 | 
			
		||||
        json: () => mockJsonPromise,
 | 
			
		||||
    });
 | 
			
		||||
    return (jest.fn().mockImplementation(() => mockFetchPromise));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('<MovieSettings/>', function () {
 | 
			
		||||
    it('renders without crashing ', function () {
 | 
			
		||||
        const wrapper = shallow(<MovieSettings/>);
 | 
			
		||||
@@ -30,7 +22,7 @@ describe('<MovieSettings/>', function () {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('test simulate reindex', function () {
 | 
			
		||||
        global.fetch = prepareFetchApi({});
 | 
			
		||||
        global.fetch = global.prepareFetchApi({});
 | 
			
		||||
        const wrapper = shallow(<MovieSettings/>);
 | 
			
		||||
 | 
			
		||||
        wrapper.find(".reindexbtn").simulate("click");
 | 
			
		||||
@@ -40,7 +32,7 @@ describe('<MovieSettings/>', function () {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    it('content available received and in state', done => {
 | 
			
		||||
        global.fetch = prepareFetchApi({
 | 
			
		||||
        global.fetch = global.prepareFetchApi({
 | 
			
		||||
            contentAvailable: true,
 | 
			
		||||
            message: "firstline\nsecondline"
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -1,40 +1,40 @@
 | 
			
		||||
.SettingsSidebar {
 | 
			
		||||
    padding-top: 20px;
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 10%;
 | 
			
		||||
    background-color: #d3dcef;
 | 
			
		||||
    float: left;
 | 
			
		||||
    min-height: calc(100vh - 56px);
 | 
			
		||||
    min-width: 110px;
 | 
			
		||||
    padding-top: 20px;
 | 
			
		||||
    width: 10%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.SettingsSidebarTitle {
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    text-transform: uppercase;
 | 
			
		||||
    font-size: larger;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin-bottom: 25px;
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    text-transform: uppercase;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.SettingsContent {
 | 
			
		||||
    float: left;
 | 
			
		||||
    width: 80%;
 | 
			
		||||
    padding-left: 30px;
 | 
			
		||||
    padding-top: 30px;
 | 
			
		||||
    width: 80%;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.SettingSidebarElement {
 | 
			
		||||
    background-color: #a8b2de;
 | 
			
		||||
    border-radius: 7px;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    margin: 10px 5px 5px;
 | 
			
		||||
    padding: 5px;
 | 
			
		||||
    background-color: #a8b2de;
 | 
			
		||||
    text-align: center;
 | 
			
		||||
    font-weight: bold;
 | 
			
		||||
    border-radius: 7px;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.SettingSidebarElement:hover {
 | 
			
		||||
    font-weight: bolder;
 | 
			
		||||
    background-color: #7d8dd4;
 | 
			
		||||
    box-shadow: #7d8dd4 0 0 0 5px;
 | 
			
		||||
    transition: all 300ms;
 | 
			
		||||
    cursor: pointer;
 | 
			
		||||
}
 | 
			
		||||
    font-weight: bolder;
 | 
			
		||||
    transition: all 300ms;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -2,14 +2,6 @@ import {shallow} from "enzyme";
 | 
			
		||||
import React from "react";
 | 
			
		||||
import SettingsPage from "./SettingsPage";
 | 
			
		||||
 | 
			
		||||
function prepareFetchApi(response) {
 | 
			
		||||
    const mockJsonPromise = Promise.resolve(response);
 | 
			
		||||
    const mockFetchPromise = Promise.resolve({
 | 
			
		||||
        json: () => mockJsonPromise,
 | 
			
		||||
    });
 | 
			
		||||
    return (jest.fn().mockImplementation(() => mockFetchPromise));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
describe('<RandomPage/>', function () {
 | 
			
		||||
    it('renders without crashing ', function () {
 | 
			
		||||
        const wrapper = shallow(<SettingsPage/>);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user