mirror of
https://github.com/rommapp/romm.git
synced 2026-12-05 05:07:31 +01:00
test(v2): align cover-ratio debounce test with 350ms re-pack delay
The re-pack debounce in useGalleryCoverRatios was raised from 150ms to
350ms (c5d844e1) to avoid a re-pack storm during fast scroll, but the
test still advanced fake timers by 150ms and expected the debounced
ratioVersion bump to have fired — so it asserted 1 and got 0. Advance
by the new 350ms delay at all three sites. Pre-existing failure on
master, unrelated to this branch's changes; bundled here to unblock CI.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -54,7 +54,7 @@ describe("useGalleryCoverRatios", () => {
|
||||
onCardRatio({ romId: 102, ratio: 0.5 });
|
||||
expect(ratioVersion.value).toBe(0); // still debouncing
|
||||
|
||||
vi.advanceTimersByTime(150);
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1); // one bump for the whole burst
|
||||
});
|
||||
|
||||
@@ -65,12 +65,12 @@ describe("useGalleryCoverRatios", () => {
|
||||
);
|
||||
|
||||
onCardRatio({ romId: 101, ratio: 0.7 });
|
||||
vi.advanceTimersByTime(150);
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1);
|
||||
expect(ratioAt(0)).toBeCloseTo(0.7);
|
||||
|
||||
onCardRatio({ romId: 101, ratio: 0.705 }); // delta 0.005 < 0.01
|
||||
vi.advanceTimersByTime(150);
|
||||
vi.advanceTimersByTime(350);
|
||||
expect(ratioVersion.value).toBe(1); // no new bump
|
||||
expect(ratioAt(0)).toBeCloseTo(0.7); // value unchanged
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user