使用Jest和Node.js在单元测试案例中无法要求文件

时间:2019-07-11 06:05:41

标签: node.js jestjs

我在使用Jest的单元测试用例中需要文件时遇到问题。以下是我想在测试用例中测试已经导出的方法的文件

use strict ';
const constantObj = require('../constants');
const request = require('request');
const restClientObj = require('../middleware/restClient');
const taxonomiesDTOObj = require('../dto/taxonomyDTO');
const utilDTOObj = require('../dto/utilDTO');
const serverBaseUrl = require('../config/config');
const async = require('async');
let processData = (options, callback) => {

});
};
module.exports = {
 processData
}

下面是需要上述文件的测试文件

const taxonomiesObj = require('../../services/taxonomies');
const utilDTOObj = require('../../dto/utilDTO');
const constantObj = require('../../constants');
describe('Testing data', function () {
it('It should process the payload and return the appropriate payload', 
(done) => {
    const callback = jest.fn(function (err, result) {
        expect(err).toBe(null);
        expect(result.status).toBe(200);
        done();
    });
    taxonomiesObj.processData(options , callback);
});
})

我遇到以下错误

enter image description here

0 个答案:

没有答案