current.creatref ток нулевой в тесте с шуткой - PullRequest
0 голосов
/ 06 января 2020

Я пытаюсь протестировать функцию handleClickCancel, но реагируем на это с помощью current как null

Структура моего компонента:

@inject('requestRefund')
@observer
export class RefoundGrid extends React.Component<
  Props & RouteComponentProps<any> & State
> {
  state = DEFAULT_STATE || [];

render() {
    const { message, typeMessage, loading } = this.props.requestRefund;
    handleClickCancel = async () => {
       this.setState({ openConfirm: false });
    };

    return (
      <BaseLayout>
      </BaseLayout>
    );
  }
}

Мой тест:

it('requestRefundRef current  test handleClickCancel ', () => {
    const refoundGridRef = React.createRef<RefoundGrid>();
    const { current } = requestRefundRef;
    console.log(current); // current is null
});

Что я могу сделать?

...