失败的js测试 - 间谍从未被调用过

时间:2016-05-25 12:07:54

标签: reactjs

在以下测试中,我收到错误:

错误:未使用[[studentId:0]]

调用间谍

有谁能告诉我studentId来自哪里以及为什么我会收到错误?

describe('<EditStudentDocuments />', () => {

var updateStudentDataSpy = expect.createSpy();

beforeEach(() => {
    mockery.enable();
});

afterEach(() => {
    mockery.disable();
});

it('should render EditStudentDocumentsTable', () => {
    var wrapper = shallow(<EditStudentDocuments />);
    expect(wrapper.find(EditStudentDocumentsTable).length).toBe(1);
});

it('should render EditStudentDocumentsTable 2', () => {
    var updateStudentDataSpy = expect.createSpy();
    var mockStudentDataActions = {
        updateStudentData: updateStudentDataSpy
    };
    mockery.registerMock('../../../actions/studentDataActions', mockStudentDataActions);

    const myRow = { };
    const data = { row : myRow, type: "myType" };
    var wrapper = shallow(<EditStudentDocuments />);
    wrapper.find(EditStudentDocumentsTable).props().onTableUpdate(data);
    expect(updateStudentDataSpy).toHaveBeenCalledWith(myRow);
});

0 个答案:

没有答案