Skip to content

Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS

1.0 KB
Raw Blame
import { describe, expect, it } from 'vitest';
import { excerptRangeFits } from './musicVideoExcerptRange.js';

describe('excerptRangeFits', () => {
  it('accepts an end up to one frame past a frame-quantized render', () => {
    expect(excerptRangeFits(0, 119.943, 119.92, 24)).toBe(true);
    expect(excerptRangeFits(0, 119.92 + 1 / 24, 119.92, 24)).toBe(true);
  });
  it('refuses an end more than a frame past the render, and empty or negative windows', () => {
    expect(excerptRangeFits(0, 120, 119.92, 24)).toBe(false);
    expect(excerptRangeFits(5, 5, 119.92, 24)).toBe(false);
    expect(excerptRangeFits(-1, 4, 119.92, 24)).toBe(false);
    // The slack is for the end only: a window starting past the render is still refused.
    expect(excerptRangeFits(119.93, 119.95, 119.92, 24)).toBe(false);
  });
  it('allows no slack without a usable fps', () => {
    for (const fps of [undefined, 0, Number.NaN]) expect(excerptRangeFits(0, 119.93, 119.92, fps)).toBe(false);
    expect(excerptRangeFits(0, 119.92, 119.92, undefined)).toBe(true);
  });
});