correct naming of Generalinfos and added tests

This commit is contained in:
2020-08-05 22:00:55 +02:00
parent 5970e4d19e
commit f87c02c276
10 changed files with 57 additions and 24 deletions

View File

@ -1,6 +1,7 @@
import {shallow} from "enzyme";
import React from "react";
import GeneralSettings from "./GeneralSettings";
import GlobalInfos from "../../GlobalInfos";
function prepareFetchApi(response) {
const mockJsonPromise = Promise.resolve(response);
@ -25,6 +26,15 @@ describe('<GeneralSettings/>', function () {
expect(wrapper.find("[data-testid='passwordfield']")).toHaveLength(1);
});
it('test theme switchbutton', function () {
const wrapper = shallow(<GeneralSettings/>);
GlobalInfos.enableDarkTheme(false);
expect(GlobalInfos.isDarkTheme()).toBe(false);
wrapper.find("[data-testid='darktheme-switch']").simulate("change");
expect(GlobalInfos.isDarkTheme()).toBe(true);
});
it('test savesettings', done => {
const wrapper = shallow(<GeneralSettings/>);