jqMockjQuery模拟测试框架
jqMock 是一个轻量级的 JavaScript 模拟测试框架,基于 jqUnit 单元测试框架。
模拟测试代码:
jqUnit.test('hello world test', function() {
    var alertMock = new jqMock.Mock(window, 'alert');
    alertMock.modify().args('hello world!').multiplicity(2).returnValue();
    hello();
    hello();
    alertMock.verify();
    alertMock.restore();
});
评论
