forked from microsoft/botframework-webchat-chat-adapter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (25 loc) · 727 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
const Observable = require("core-js/features/observable");
function firstObservation(observable) {
let subscription;
return new Promise((resolve, reject) => {
subscription = observable.subscribe({
complete() {
reject(new Error("No result were received."));
},
error: reject,
next: resolve,
start(thisSubscription) {
subscription = thisSubscription;
},
});
}).finally(() => subscription.unsubscribe());
}
// Usage
// const id = await firstObservation(directLine.postActivity({}));
(async function () {
const id = await firstObservation(Observable.from([1, 2, 3]));
console.log(id);
})().catch(() => {});
test("sample test..",()=>{
expect(true);
})