How does one unit test routes with Express?

后端 未结 8 2159
一整个雨季
一整个雨季 2020-12-07 08:38

I\'m in the process of learning Node.js and have been playing around with Express. Really like the framework;however, I\'m having trouble figuring out how to write a unit/i

8条回答
  •  春和景丽
    2020-12-07 09:30

    Change your response object:

    var response = {
        viewName: ""
        , data : {}
        , render: function(view, viewData) {
            this.viewName = view;
            this.data = viewData;
        }
    };
    

    And it will work.

提交回复
热议问题