-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sinon 学习 #21
Comments
const sinon = require('sinon'); // spies 主要用于收集函数的调用信息 const user = { // 使用 stub 的时候原是函数就不会被执行 // stub 常用场景是验证一个函数是否使用特定的参数 // describe('saveUser', function() { // //We'll stub $.post same as before // //We'll set up some variables to contain the expected results // //We can also set up the user we'll save based on the expected data // saveUser(user, function(){} ); // sinon.assert.calledWith(post, expectedUrl, expectedParams); // mock 可以定义期望的结果和期望的行为 // 最佳实践,使用sinon.test() // spy本质是一个函数wrapper // stub 其实就是替换 |
No description provided.
The text was updated successfully, but these errors were encountered: