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?