【发布时间】:2018-10-02 13:41:56
【问题描述】:
我对 mocha 很陌生,并且一直在测试以下功能。我有以下字符串replace_underscore_with_hyphen。我正在使用以下功能将其替换为 replace-underscore-with-hyphen。
const type = "replace_underscore_with_hyphen";
type = type.replace(/_/ig, '-');
但是请我知道如何在 mocha 中测试此功能。
【问题讨论】:
-
这取决于这段代码出现的位置。该问题不包含它的上下文。
标签: javascript node.js mocha.js chai