Why promise.then(function(value) { pm.sendRequest ... }) does not work?

Hi,

I wrote a function to wait for my async API to be done first and execute related tests later.

something like below:

wait_for_task_to_be_done(jsonData.taskId).then(function(value) {

    pm.test("Test A", function () {
        pm.expect(data).to.eql("expectation"));
    });

    pm.sendRequest( ... ,function (err, res) {
        pm.test("Test B", function () {
            pm.expect(data).to.eql("expectation"));
        });
    })

    pm.test("Test C", function () {
        pm.expect(data).to.eql("expectation"));
    });

});

However, the β€œTest B” not showing up in test result but the β€œTest A” and β€œTest C” working perfectly.
And I checked the console output, the request has never been sent, it seems like the pm.sendRequest is not working in promise.then().

Could anyone help? Any workaround?