Skip to content

Commit b04190e

Browse files
authored
[core-lro] Using await to test that pollUntilDone throws (#7530)
* [core-lro] Using await to test that pollUntilDone throws * formatting
1 parent 81fb8f7 commit b04190e

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

sdk/core/core-lro/test/abort.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,7 @@ describe("Long Running Operations - working with abort signals", function() {
8383
const abortController = new AbortController();
8484
const poller = await client.startLRO();
8585

86-
// Testing subscriptions to the poll errors
87-
let doneError: Error | undefined;
88-
poller.pollUntilDone().catch((e) => {
89-
doneError = e;
90-
});
86+
const donePromise = poller.pollUntilDone();
9187

9288
await poller.poll();
9389
assert.equal(client.totalSentRequests, 2);
@@ -102,8 +98,14 @@ describe("Long Running Operations - working with abort signals", function() {
10298
} catch (e) {
10399
pollError = e;
104100
}
105-
106101
assert.equal(pollError!.message, "The operation was aborted.");
102+
103+
let doneError: Error | undefined;
104+
try {
105+
await donePromise;
106+
} catch (e) {
107+
doneError = e;
108+
}
107109
assert.equal(doneError!.message, "The operation was aborted.");
108110

109111
assert.equal(client.totalSentRequests, 2);

0 commit comments

Comments
 (0)