const assert = require('assert'); const userService = require('../service/user/userService')
describe('#userService.js', function(){ before(function () { console.log('before:'); });
after(function () {
console.log('after.');
});
let testData = {};
beforeEach(function () {
console.log('beforeEach:');
testData = {
code: '200',
name: 'ceshi'
}
});
afterEach(function () {
console.log(' afterEach.');
});
describe('#add()', function(){
//不鼓励将箭头函数(“lambdas”)传递给Mocha。Lambdas词法绑定this,无法访问Mocha上下文。
it('sum() should return 0',async function(){
try {
let data = await userService.addNotice(testData)
console.log(data, 'data====')
assert.equal(data.code, '200');
} catch (err) {
console.log(err)
assert.ifError(err);
}
});
});
});