fix unit tests
This commit is contained in:
parent
f8dbadc45b
commit
7ebc5766e9
@ -25,7 +25,7 @@ describe('<NewActorPopupContent/>', () => {
|
|||||||
const wrapper = shallow(<NewActorPopupContent onHide={() => {func();}}/>);
|
const wrapper = shallow(<NewActorPopupContent onHide={() => {func();}}/>);
|
||||||
|
|
||||||
// manually set typed in actorname
|
// manually set typed in actorname
|
||||||
wrapper.instance().value = 'testactorname';
|
wrapper.instance().nameValue = 'testactorname';
|
||||||
|
|
||||||
global.fetch = prepareFetchApi({});
|
global.fetch = prepareFetchApi({});
|
||||||
|
|
||||||
@ -55,6 +55,6 @@ describe('<NewActorPopupContent/>', () => {
|
|||||||
|
|
||||||
wrapper.find('input').simulate('change', {target: {value: 'testinput'}});
|
wrapper.find('input').simulate('change', {target: {value: 'testinput'}});
|
||||||
|
|
||||||
expect(wrapper.instance().value).toBe('testinput');
|
expect(wrapper.instance().nameValue).toBe('testinput');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -109,7 +109,20 @@ describe('<Player/>', function () {
|
|||||||
|
|
||||||
const func = jest.fn();
|
const func = jest.fn();
|
||||||
|
|
||||||
wrapper.setProps({history: {goBack: func}});
|
wrapper.setProps({history: {push: func}});
|
||||||
|
|
||||||
|
expect(func).toHaveBeenCalledTimes(0);
|
||||||
|
wrapper.find('.closebutton').simulate('click');
|
||||||
|
// there shouldn't be a backstack available
|
||||||
|
expect(func).toHaveBeenCalledTimes(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('hide click with stack available', function () {
|
||||||
|
const wrapper = instance();
|
||||||
|
|
||||||
|
const func = jest.fn();
|
||||||
|
|
||||||
|
wrapper.setProps({history: {goBack: func, length: 5}});
|
||||||
|
|
||||||
expect(func).toHaveBeenCalledTimes(0);
|
expect(func).toHaveBeenCalledTimes(0);
|
||||||
wrapper.find('.closebutton').simulate('click');
|
wrapper.find('.closebutton').simulate('click');
|
||||||
|
@ -316,7 +316,7 @@ export class Player extends React.Component<Props, mystate> {
|
|||||||
closebtn(): void {
|
closebtn(): void {
|
||||||
const hist = this.props.history;
|
const hist = this.props.history;
|
||||||
if (hist.length > 1) {
|
if (hist.length > 1) {
|
||||||
this.props.history.goBack();
|
hist.goBack();
|
||||||
} else {
|
} else {
|
||||||
hist.push('/');
|
hist.push('/');
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user