如何使用jasmine节点在Node.js中模拟seneca调用?

如何使用jasmine节点在Node.js中模拟seneca调用?,node.js,mocking,jasmine-node,Node.js,Mocking,Jasmine Node,我正在使用express模块,下面是app.js的代码 app.post('/test_url', function(request, response){ seneca.client({type: 'http',port: '3000',host: 'localhost',protocol: 'http'}).act({role: 'sample_role', cmd: 'save',firstname: request.params.firstname}, function (err

我正在使用express模块,下面是app.js的代码

app.post('/test_url', function(request, response){
    seneca.client({type: 'http',port: '3000',host: 'localhost',protocol: 'http'}).act({role: 'sample_role', cmd: 'save',firstname: request.params.firstname}, function (err, result) {
        console.log("Inside Seneca act");
        response.json(result);
    })
});
下面是我为上述代码编写测试用例的测试文件

describe("POST /test_url/:firstname", function() {
    it("should return status code 200", function(done) {
        <b>//here I want to mock the call for seneca.client so that I can test if the call has been made with the required parameters.</b>
        <b>//Also I would like to use the above mock object to further mock the call for act so that I can check if the act method has been called with the required parameters.'</b>
        //Main purpose behind doing so is that I do not want the seneca methods to get actually called, and only want to test if the call has been made.

        request.post("http://localhost:3000/test_url/sara", function(error, response, body) {
            //some verification method on the mock object so as to confirm that both the calls i.e 'seneca.client' and 'seneca.client().act' have been called with the appropriate parameters
            expect(body).toContain("success");              
            done();
        });
    });
});
describe("POST /test_url/:firstname", function() {
    it("should return status code 200", function(done) {
        var senecaCall = sinon.stub(seneca, 'client');
        //or spyOn(seneca, "client");

        request.post("http://localhost:3000/test_url/sara", function(error, response, body) {       
            expect(body).toContain("success");              
            done();
        });
    });
});