【发布时间】:2019-09-02 07:37:20
【问题描述】:
我不习惯测试或编写 Angular 代码,所以我想知道如何测试返回 void 并更改类变量的方法(在本例中为 changeMyMonth)?
date: Date = new Date();
private dateArray: Date[];
private getMaxDaysInMonth(): number {
return new Date(this.date.getFullYear(), this.date.getMonth() + 1, 0).getDate();
}
changeMyMonth(amount: number): void {
this.date= new Date(
this.date.getFullYear(),
this.date.getMonth() + amount, 1);
this.dateArray= this.getArrayOfDates(this.getMaxDays(), this.date);
}
【问题讨论】:
标签: angular unit-testing jestjs