单元测试ng2-file-upload

时间:2018-10-24 12:39:43

标签: angular typescript

我准备了使用ng2-file-upload库的组件。一切正常,不幸的是,在进行单元测试时,存在许多问题。例如:

    fileSelectDirective.uploader.queue.push(new FileItem(fileSelectDirective.uploader,new File([],"fileName"),{}));
    spyOn(fileSelectDirective.uploader.queue, "pop");

    component.onDeleteClick();

    expect(fileSelectDirective.uploader.queue.pop).toHaveBeenCalled();
    expect(fileSelectDirective.uploader.queue[0]).not.toBeDefined();

在函数中返回false(不调用pop)。也许有人知道有一些测试的任何好的教程或链接到github?

0 个答案:

没有答案