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

**URL:** <https://community.postman.com/t/why-promise-then-function-value-pm-sendrequest-does-not-work/3462>\
**Category:** Help Hub\
**Tags:** async\
**Created:** [December 3, 2018, 9:48am UTC](https://community.postman.com/t/why-promise-then-function-value-pm-sendrequest-does-not-work/3462 "2018-12-03T09:48:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Timmy\_Lin](https://avatars.discourse-cdn.com/v4/letter/t/7ab992/32.png) [@Timmy\_Lin](https://community.postman.com/u/Timmy_Lin)\
**Post date:** [December 3, 2018, 9:48am UTC](https://community.postman.com/t/why-promise-then-function-value-pm-sendrequest-does-not-work/3462/1 "2018-12-03T09:48:10Z")

</div>

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?
