运行 测试未达到预期 运行

Run test are not running as expected

我运行下面的测试,它不会在快速路由器的动作中停止 URL 正是我放入 postman 并起作用的 url,知道吗?

描述('test',函数(){

it('Should Run///',
    function (done) {

        supertest(app)
            .post('http://localhost:3002//save/test1/test2/test3')
            .expect(200)
            .end(function (err, res) {
                res.status.should.equal(200);
                done();
            });

    });

    in the following code its not stopping in the post  (console.log...)what am I missing here?

    module.exports = function (app, express) {

var appRouter = express.Router();
app.use(appRouter);
//Route Application Requests
appRouter.route('*')
    .post(function (req, res) {
        console.log("test");
    })

您没有在路由处理程序中发送响应:

appRouter.route('*')
    .post(function (req, res) {
        console.log("test");
        return res.sendStatus(200); // <-- actually send back a response!
    });

此外,从您的代码看来,您正在将 Express 应用程序而非服务器传递给 Supertest,在这种情况下,您可能需要使用这个:

.post('/save/test1/test2/test3')

(而不是完整的 url)