我正在自我介绍中进行快速测试,而我的这段代码不起作用:
suite('Functional Tests', function() {
suite('POST /api/issues/{project} => object with issue data', function() {
console.log('1');
test('Every field filled in', function(done) {
console.log('2');
chaiModule
.request(server)
.post('/api/issues/test')
.type('form')
.set('content-type', 'application/x-www-form-urlencoded')
.send({
issue_title: 'Title',
issue_text: 'text',
created_by: 'Functional Test - Every field filled in',
assigned_to: 'Chai and Mocha',
status_text: 'In QA'
})
.end(function(err, res) {
console.log('post res ', res);
assert.equal(res.status, 200);
//fill me in too!
assert.equal(res.body.issue_title, 'Title');
assert.equal(res.body.issue_text, 'text');
assert.equal(
res.body.created_by,
'Functional Test - Every field filled in'
);
assert.equal(res.body.assigned_to, 'Chai and Mocha');
assert.equal(res.body.status_text, 'in QA');
done();
});
});
test('Required fields filled in', function(done) {});
test('Missing required fields', function(done) {});
});
此后端没有问题,正在运行,我希望它最终记录响应,但不是吗?我只是不知道这段代码出了什么问题。