Debian Codegraph @

packages/babel-plugin-proposal-async-generator-functions/test/fixtures/async-generators/declaration-exec/exec.js

raw
1 "use strict";
2
3 const actual = [];
4 const expected = ["foo_0", "bar_1", "baz_2"];
5
6 async function* test() {
7 actual.push(yield await Promise.resolve("foo"));
8 actual.push(yield await Promise.resolve("bar"));
9 actual.push(yield await Promise.resolve("baz"));
10 }
11
12 async function main() {
13 const g = test();
14 let i = 0;
15 await g
16 .next()
17 .then(({ value }) => g.next(`${value}_${i++}`))
18 .then(({ value }) => g.next(`${value}_${i++}`))
19 .then(({ value }) => g.next(`${value}_${i++}`));
20 }
21
22 return main().then(() => {
23 expect(actual).toEqual(expected);
24 });