Skip to content

Commit 2f43cea

Browse files
committed
add back some tests
1 parent d80c2a1 commit 2f43cea

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

src/execution/__tests__/Queue-test.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,34 @@ describe('Queue', () => {
8787
expect(await sub.next()).to.deep.equal({ done: false, value: [1, 2, 3] });
8888
});
8989

90+
it('should ignore sync error in the executor', async () => {
91+
let push!: (item: number) => void;
92+
const queue = new Queue<number>((_push) => {
93+
push = _push;
94+
throw new Error('Oops');
95+
});
96+
97+
push(1);
98+
99+
const sub = queue.subscribe((batch) => Array.from(batch));
100+
expect(await sub.next()).to.deep.equal({ done: false, value: [1] });
101+
});
102+
103+
it('should ignore async error in the executor', async () => {
104+
let push!: (item: number) => void;
105+
const queue = new Queue<number>(async (_push) => {
106+
push = _push;
107+
await resolveOnNextTick();
108+
throw new Error('Oops');
109+
});
110+
111+
await resolveOnNextTick();
112+
push(1);
113+
114+
const sub = queue.subscribe((batch) => Array.from(batch));
115+
expect(await sub.next()).to.deep.equal({ done: false, value: [1] });
116+
});
117+
90118
it('should skip payloads when mapped to undefined, skipping first async payload', async () => {
91119
const queue = new Queue<number>(async (push) => {
92120
await resolveOnNextTick();

0 commit comments

Comments
 (0)