Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Typescript &引用;警告:提供的容器无效";开玩笑_Typescript_Unit Testing_Jestjs_Snapshot Testing - Fatal编程技术网

Typescript &引用;警告:提供的容器无效";开玩笑

Typescript &引用;警告:提供的容器无效";开玩笑,typescript,unit-testing,jestjs,snapshot-testing,Typescript,Unit Testing,Jestjs,Snapshot Testing,我有以下测试: describe('if initialized', () => { const loadProjects = jest.fn(); let tree: ReactTestRenderer | null; renderer.act(() => { tree = renderer.create( <I18nextProvider i18n={i18n}> <EstimatesTablePure

我有以下测试:

describe('if initialized', () => {
  const loadProjects = jest.fn();
  let tree: ReactTestRenderer | null;
  renderer.act(() => {
    tree = renderer.create(
      <I18nextProvider i18n={i18n}>
        <EstimatesTablePure
          projects={ROWS}
          limit={10}
          loadingProjects={false}
          loadProjects={loadProjects}
        />
      </I18nextProvider>,
    );
  });

  it('should render content', () => {
    expect(tree!!.toJSON()).toMatchSnapshot();
  });

  it('should call loadProjects', () => {
    expect(loadProjects).toBeCalledTimes(1);
  });

});
description('if initialized',()=>{
const loadProjects=jest.fn();
let tree:ReactTestRenderer | null;
.act(()=>{
tree=renderer.create(
,
);
});
它('应该呈现内容',()=>{
expect(tree!!.toJSON()).toMatchSnapshot();
});
它('应该调用loadProjects',()=>{
expect(loadProjects)。toBeCalledTimes(1);
});
});
我得到了以下错误:

我在寻找解决方案,发现:但仍然不知道如何解决这个问题