toString方法应返回正确的层次结构(嵌套回复)

时间:2018-10-01 03:41:40

标签: javascript unit-testing

getString(comment) {
const authorName = comment.getAuthor().getName();
if (!comment.getRepliedTo()) return authorName;
return `${comment.getMessage()} by ${authorName} (replied to 
${this.getString(comment.getRepliedTo())})`;
}
toString() {
const authorName = this.getAuthor().getName();
if (!this.getRepliedTo()) {
return `${this._message} by ${authorName}`;
}
return this.getString(this);
}
}

请帮助,它会不断给我这个错误。

toString方法应返回正确的层次结构(嵌套答复)

0 个答案:

没有答案