摩卡测试功能在其他人内部

时间:2018-06-07 18:02:01

标签: typescript mocha chai

我有以下代码的snippit我正在尝试单元测试

export class InviteCoupleComponent implements OnInit {
  //more stuff/functions here ...
  inviteCouple() {
    this._facilitatorService.inviteCouple(this.coupleForm.value)
      .subscribe(ret => {
        if (ret.code === 200) {
          alert('Invitations Sent');
          this.router.navigate(['']);
        } else if (ret.code === 409) {
          alert('A user already exists with the email address ' + ret.data.join(', '));
        }
      });
  }

在导出的函数内部,我试图用mocha.js进行单元测试(我是mocha的新手)我正在使用chai断言库,但我没有附加到它。在这里,我试图检查案件。如何查看chai中的警报我似乎无法找到任何内容。

Testing js alert with Chai Mocha

是我能找到的所有关于是否发生警报的内容。 thx不是警报本身。

0 个答案:

没有答案