add test to test savesettings

This commit is contained in:
2020-07-12 13:12:13 +02:00
parent 7954af888d
commit 24dac2135c
2 changed files with 21 additions and 1 deletions

View File

@ -24,4 +24,22 @@ describe('<GeneralSettings/>', function () {
expect(wrapper.find("FormGroup").findWhere(it => it.props().controlId === "passwordfield")).toHaveLength(1);
});
it('test savesettings', done => {
const wrapper = shallow(<GeneralSettings/>);
global.fetch = prepareFetchApi({success: true});
expect(global.fetch).toBeCalledTimes(0);
wrapper.find("[data-testid='mainformsettings']").simulate("submit");
expect(global.fetch).toBeCalledTimes(1);
process.nextTick(() => {
// expect callback to have loaded correct tag
expect(wrapper.state().selected).toBe("testname");
global.fetch.mockClear();
done();
});
});
});