checkpoint: pre-split branch cleanup
This commit is contained in:
parent
4c2ae2e5b7
commit
b5db7a7753
276 changed files with 35912 additions and 60119 deletions
|
|
@ -1,33 +1,33 @@
|
|||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import { ProjectEventCoalescer } from '../../src/lib/coalescer';
|
||||
|
||||
test('coalescer emits latest payload once per project within debounce window', async () => {
|
||||
const flushed: Array<{ projectRoot: string; payload: { value: string } }> = [];
|
||||
const coalescer = new ProjectEventCoalescer<{ value: string }>(20, (event) => {
|
||||
flushed.push(event);
|
||||
});
|
||||
|
||||
coalescer.queue('C:/Repo/One', { value: 'first' });
|
||||
coalescer.queue('c:\\repo\\one', { value: 'second' });
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 45));
|
||||
|
||||
assert.equal(flushed.length, 1);
|
||||
assert.equal(flushed[0].payload.value, 'second');
|
||||
});
|
||||
|
||||
test('coalescer keeps distinct projects separated', async () => {
|
||||
const flushed: Array<{ projectRoot: string; payload: { value: string } }> = [];
|
||||
const coalescer = new ProjectEventCoalescer<{ value: string }>(20, (event) => {
|
||||
flushed.push(event);
|
||||
});
|
||||
|
||||
coalescer.queue('C:/Repo/One', { value: 'one' });
|
||||
coalescer.queue('D:/Repo/Two', { value: 'two' });
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 45));
|
||||
|
||||
assert.equal(flushed.length, 2);
|
||||
});
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
|
||||
import { ProjectEventCoalescer } from '../../src/lib/coalescer';
|
||||
|
||||
test('coalescer emits latest payload once per project within debounce window', async () => {
|
||||
const flushed: Array<{ projectRoot: string; payload: { value: string } }> = [];
|
||||
const coalescer = new ProjectEventCoalescer<{ value: string }>(20, (event) => {
|
||||
flushed.push(event);
|
||||
});
|
||||
|
||||
coalescer.queue('C:/Repo/One', { value: 'first' });
|
||||
coalescer.queue('c:\\repo\\one', { value: 'second' });
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 45));
|
||||
|
||||
assert.equal(flushed.length, 1);
|
||||
assert.equal(flushed[0].payload.value, 'second');
|
||||
});
|
||||
|
||||
test('coalescer keeps distinct projects separated', async () => {
|
||||
const flushed: Array<{ projectRoot: string; payload: { value: string } }> = [];
|
||||
const coalescer = new ProjectEventCoalescer<{ value: string }>(20, (event) => {
|
||||
flushed.push(event);
|
||||
});
|
||||
|
||||
coalescer.queue('C:/Repo/One', { value: 'one' });
|
||||
coalescer.queue('D:/Repo/Two', { value: 'two' });
|
||||
|
||||
await new Promise((resolve) => setTimeout(resolve, 45));
|
||||
|
||||
assert.equal(flushed.length, 2);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue