Answer the question
In order to leave comments, you need to log in
How to cover a piece of code with if with tests?
export class Countries extends React.Component<Props, State> {
private countriesList: React.RefObject<HTMLDivElement> = React.createRef<
HTMLDivElement
>();
public componentDidMount(): void {
setTimeout(this.whenCDM, 1);
}
public render(): React.ReactNode {
return (
<div ref={this.countriesList}>
</div>
);
}
private whenCDM = (): any => {
if (this.countriesList.current) {
this.whenComponentDidMount(
this.countriesList.current.getBoundingClientRect().top
);
}
};
}
Answer the question
In order to leave comments, you need to log in
Make tests for which all conditions will be fulfilled in all cases.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question