Files
Echoion/EchoionWeb/frontend/src/components/NowPlayingVideo.test.ts
T
faumaray 24fecc90f3 making WEB
Signed-off-by: faumaray <faumaray@gmail.com>
2026-07-11 00:47:52 +03:00

17 lines
619 B
TypeScript

import { describe, expect, it } from 'vitest';
import { shouldCorrectVideoDrift } from '../lib/nowPlayingVideoSync';
describe('NowPlayingVideo drift correction', () => {
it('never seeks while unstarted, cued, or buffering', () => {
for (const state of [-1, 3, 5]) {
expect(shouldCorrectVideoDrift(state, 0, 30, 10_000)).toBe(false);
}
});
it('waits for cooldown and ignores small playing drift', () => {
expect(shouldCorrectVideoDrift(1, 0, 30, 1000)).toBe(false);
expect(shouldCorrectVideoDrift(1, 28, 30, 10_000)).toBe(false);
expect(shouldCorrectVideoDrift(1, 10, 30, 10_000)).toBe(true);
});
});